Git Product home page Git Product logo

facile's Introduction

Xavier Olive | Homepage | Twitter | Mastodon | GitHub | ResearchGate | LinkedIn | Stack Overflow | Strava

GitHub metrics

I am a research scientist at ONERA, the French Aerospace Lab, passionate about aviation, maps and data.

My research interests include Data Science, Machine Learning and Decision Science applied to aviation, with a particular focus on optimisation, anomaly and pattern detection. Applications range from air traffic management, operations, predictive maintenance, safety analyses and risk assessment.

Although my main job revolves around academic research, writing proposals and research papers, I consider decent software engineering, sharing among peers and with the general public, and reproducibility of results key components of my activity.

Book

Programmation Python avancée

I am the author of the Python book (in French) Programmation Python avancée – Guide pour une pratique élégante et efficace (ISBN 978-2-10-081598-2), available from May 5th, 2021.

A second edition is planned for September 2024.

python

GitHub languages

I am also one of the main contributors of the (hatching) book A journey through aviation data.

python

Software libraries

I am the main developper of the traffic library suite designed for analysing air traffic trajectory data.

traffic
traffic.js
traffic-rs

It heavily relies on more libraries I contribute to:

cartes rs1090 pitot impunity pyModeS

Community and interests

GitHub stars

GitHub stargazers

Teaching materials

pyclass optim4ai constraints

The facile library is a Python binding to a research-oriented constraint satisfaction and optimisation solver originally written in OCaml. The library offers a comfortable syntax for teaching purposes. I wrote a basic blog post few years ago to explain the technical tour de force it has been to implement a binding between two such different languages.

facile

Scientific records

Available on my personal website

facile's People

Contributors

dependabot[bot] avatar xoolive avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

facile's Issues

More explicit error message for constraint disjunction type error

import facile
x = [facile.variable(0,1) for i in range (10)]
for a in range(10):
   for b in range(a, 10):
       c1 = 2*a != b
       c2 = x[a]!=x[b]
       facile.constraint( c1 | c2 )

A better error message than AttributeError: 'bool' object has no attribute '__getval' should be produced.

Besides, if you type facile.constraint( c2 | c1 ), you get the following error message:
TypeError: Argument 'c' has incorrect type (expected facile.Cstr, got bool)

Two-(and more) dimension facile.array

It may be necessary to have two-dimension arrays indexed by variables on both dimensions.
There is always the solution of index linearisation, but if the two-dimension option is feasible, it should be implemented.

Better `SyntaxError` for __bool__ or __nonzero__ on constraints

The following methods have been implemented as we wanted to prevent users to call native min() or max() function on an array of expressions.

    # For Python 2.x
    def __nonzero__(self):
        print (array.__doc__)
        raise SyntaxError("This operation is not allowed. Check facile.array()")

    # For Python 3.x
    def __bool__(self):
        print (array.__doc__)
        raise SyntaxError("This operation is not allowed. Check facile.array()")

However, this exception makes no sense when raised upon writing the following code:

[a, b] = [facile.variable(0, 1) for i in range(2)]
# The user probably wanted to write facile.constraint(a == b | b != 0)
if a != b:
    facile.constraint(b != 0)

Consider supporting some operators on Arrays

>>> a = [facile.variable(0,3) for i in range(2)]
>>> b = [facile.variable(0,3) for i in range(2)]
>>> a == b

Raises a SyntaxError and offer to refer to facile.array

>>> a = [facile.variable(0,3) for i in range(2)]
>>> b = facile.array([facile.variable(0,3) for i in range(2)])
>>> a == b
False

Proper Goal interface

A proper interface to the Goal module shall be considered for a Python binding.

Keywords: heuristics, labelling, callback, Fail, Success
see golf.ml, tiles.ml, scheduling.ml, jobshop.ml

Exception to pass through to Python

Lazy students often write stupid constraints equivalent to the following one:

import facile
a = facile.variable(1, 2)
facile.constraint(a != a)
Fatal error: exception Fcl_stak.Fail("zero")
zsh: exit 2     python

which corresponds more or less to the following in Caml:

# open Facile;;
# open Easy;;      
# let a = Fd.interval 1 2;;
val a : Facile.Easy.Fd.t = <abstr>
# Cstr.post (fd2e a <>~ fd2e a);;
Exception: Fcl_stak.Fail "zero".

You cannot blame stupid students. This exception should be caught in Python and print a meaningful message.

Automatic unravelling of variables array upon solve/minimize?

facile.solve and facile.minimize only accept one-dimension arrays (Python iterable, numpy, or facile version) of variables. When we manipulate two-(or more) dimension arrays, we may appreciate to have the array automatically unravelled.
The following question will however arise: should the return type be of the same structure as the entry array (of arrays?) — at the risk of having to follow up with a tricky structure — or should we return an unravelled version?

Unified interface for resolution

The interface for solve() and minimize() has been developed ad hoc and may need some freshening/refactoring.

  • I don't like the fact that the interfaces that trigger the resolution process are not consistent: one returns a boolean (False if no solution exists), a counter of backtracks is attached if you enable a proper option; the other returns an array of solutions, [] if no solution exists.
  • Some users get confused by minimize() and solve() and think they have to call them both in this order so as to get a solution. Is it a documentation issue or an interface issue?
  • Some heuristics are hard-coded and passed as arguments for the needs of attached examples and/or exercises for students. This access to resolution heuristics should be thought of more carefully. Try the new interface on the golf tournament problem golf.ml.
  • Also, a decent interface that would transcript prolog.ml would be a plus!

Missing __not__ operator on constraints

Also consider whether there is a way to implement =>, <=> and xor as infix operator.
For now, it would be great to have:

[a, b] = [facile.variable(0, 1) for i in range(2)]
c = a != b
facile.constraint(not c)

Refer to the official documentation.

Some variables remain unassigned when using `Goals.forall`

gx = facile.Goal.forall(x, assign="assign")
gy = facile.Goal.forall(y, assign="assign")
# EDIT: si on ajoute l'heuristique min_min, ça tombe en marche
# gx = facile.Goal.forall(x, strategy="min_min", assign="assign")
# gy = facile.Goal.forall(y, strategy="min_min", assign="assign")
gxs = facile.Goal.forall(xln)

# Now the proper resolution process
sol = facile.solve_all(gx & gy & gxs, backtrack=True)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.