Anda di halaman 1dari 22

An introduction to Choco 3.

0
an Open Source Java Constraint Programming Library

C.Prudhomme, JG. Fages EMNantes, INRIA TASC, CNRS LINA Nantes, France

16th September 2013

16th September 2013

CPSolvers 2013 Choco

1 / 22

The Choco constraint solver

Outline

1 The Choco constraint solver 2 Inside Choco 3 Dealing with real world problems 4 The future of Choco

16th September 2013

CPSolvers 2013 Choco

2 / 22

The Choco constraint solver

A solver for teaching and research


History 1999 a rst CLAIRE impl. within the OCRE project
an national initiative for an open constraint solver for both teaching and research (Nantes, Montpellier, Toulouse, Bouygues, ONERA)

2003 Choco 1.0 : a rst Java implementation


Portability, ease of use for newcomers, etc.
Guillaume Rochart (Bouygues), Hadrien Cambazard (Grenoble INP)

2008 Choco 2.0 : a user-oriented version


Separation between modeling and solving, more constraints.
Charles Prudhomme (EMN), Hadrien Cambazard, Arnaud Malapert (Univ. Nice)

2013 Choco 3.0 : towards eciency and reliability !


Deep code refactoring, easy-to-use (and to maintain)
Charles Prudhomme, Jean-Guillaume Fages (EMN), Xavier Lorca (EMN)

16th September 2013

CPSolvers 2013 Choco

3 / 22

The Choco constraint solver

An open constraint solver


Open (online source repository a , BSD license) Readable and exible (designed for teaching and research) Ecient and reliable (solves real world problems) More than 60000 DL (2003-2013), worldwide Code : > 60k LOC, > 700 Classes
a. github.com/chocoteam/choco3

16th September 2013

CPSolvers 2013 Choco

4 / 22

The Choco constraint solver

Academic users

In France :
Universities : Nantes, Montpellier, Paris, Rennes, Toulouse, Clermont-Ferrand des Mines de Engineering schools : ENSTA, ENAC, Ecole Nancy, Ecole des Mines de Nantes, ISIMA

Around the world :


UK : University of Glasgow Ireland : University of Cork Canada : Ecole Polytechnique de Montreal

16th September 2013

CPSolvers 2013 Choco

5 / 22

The Choco constraint solver

Industrial users

Big companies : Safran, Dassault, PSA Research agencies : ONERA, NASA Software and Integrators : Kls-Optim, alfaplan GmbH, Easyvirt, Hedera Technology, etc.

16th September 2013

CPSolvers 2013 Choco

6 / 22

Inside Choco

Outline

1 The Choco constraint solver 2 Inside Choco 3 Dealing with real world problems 4 The future of Choco

16th September 2013

CPSolvers 2013 Choco

7 / 22

Inside Choco

Embedded Variable Types

A wide variety of variable paradigms : Integer variables Boolean variables Set variables Graph variables Real variables

16th September 2013

CPSolvers 2013 Choco

8 / 22

Inside Choco

A Large Choice of Implemented Constraints

More than 80 available constraints in Choco : Classical arithmetic constraints : =, =, <, , >, , A large set of useful global constraints : AllDierent, GlobalCardinality, NValue, Cumulative, Din, Occurrence, Element, Regular, Circuit . . . Exclusive constraints : Tree, CostRegular, Ibex . . . Reied constraints : any constraint can be reied.

16th September 2013

CPSolvers 2013 Choco

9 / 22

Inside Choco

Discrete-continuous hybridization

The Ibex global constraint : Handles numerous non linear continuous expressions
+, , , /, =, <, >, , , min, max, abs, sqr, sqrt, exp, log, pow, cos, sin, tan, acos, asin, atan ...

Can mix integer and real variables.

16th September 2013

CPSolvers 2013 Choco

10 / 22

Inside Choco

Explanations

Choco natively supports explained constraints. Both generic and ad hoc explanations schemas Asynchronous and lazy computation, attened or unattened storage Improve resolution (CBJ, DBT, path repair, LNS) Next steps : Providing feedback to the user Nogood recording / SAT Solver interaction

16th September 2013

CPSolvers 2013 Choco

11 / 22

Inside Choco

Search-related tools

Dierent kinds of use : Get a solution, Enumerate all solutions, Find an optimal solution Predened search methods : Built-in search strategies (DomWDeg, ABS, IBS, etc.) and some optimization procedures (LNS, fast restart, Last Conict, etc.).

16th September 2013

CPSolvers 2013 Choco

12 / 22

Inside Choco

An intuitive user interface

Use of Factories to build a model : Variables : VariableFactory , Constraints : IntConstraintFactory , LogicalConstraintFactory , SetConstraintsFactory . . . Strategies : IntStrategyFactory , SetStrategyFactory . . .

16th September 2013

CPSolvers 2013 Choco

13 / 22

Inside Choco

Choco diusion

Contestant within the MiniZinc Challenge (2012, 2013) JSR-331 implementation (in progress) CP-Viz interface One-sheet documentation, teaching materials, articles, demo material (> 60 examples), etc.

16th September 2013

CPSolvers 2013 Choco

14 / 22

Inside Choco

Langfords number problem


The problem is to arrange k sets of numbers 1 to n so that each appearance of the number m is m numbers on from the last. Ex : L(k = 3, n = 9)= 3 4 7 8 3 9 4 5 3 6 7 4 8 5 2 9 6 2 7 5 2 8 1 6 1 9 1

S o l v e r s = new S o l v e r ( L a n g f o r d ) ; I n t V a r [ ] p = VF . e n u m e r a t e d A r r a y ( p , n k , 0 , k n 1, s ) ; f o r ( i n t i = 0 ; i < n ; i ++) { f o r ( i n t j = 0 ; j < n ( k 1 ) ; j+=n ) { s . p o s t ( ICF . a r i t h m (VF . o f f s e t ( p [ i+j ] , i +2) , = , p [ i +( j+n ) ] ) ) ; } } s . p o s t ( ICF . a r i t h m ( p [ 0 ] , < , p [ n k 1 ] ) ) ; s . p o s t ( ICF . a l l d i f f e r e n t ( p o s i t i o n , AC ) ) ; s . s e t ( ISF . f i r s t F a i l I n D o m a i n M a x ( p o s i t i o n ) ) ; s . findSolution ();

16th September 2013

CPSolvers 2013 Choco

15 / 22

Dealing with real world problems

Outline

1 The Choco constraint solver 2 Inside Choco 3 Dealing with real world problems 4 The future of Choco

16th September 2013

CPSolvers 2013 Choco

16 / 22

Dealing with real world problems

Attacking real world problems

Entropy, Easyvirt, Hedera : data center management (VM placement), Vaberlin, GSD lab : software development, code generation, Safran, Dassault Aviation : mission planning, KLS Optim, Optilogistic : loading plans for vehicles and palettes, Biotrial, Maif : personal scheduling, Kosmos : timetabling for secondary schools, PSA : online car conguration (prototype),

16th September 2013

CPSolvers 2013 Choco

17 / 22

Dealing with real world problems

Entropy

They like Modeling (declarative, reliable), Ad hoc constraints (simplicity), Scalability (more than 100,000 VMs). Issues Clear problem statement, Unaware of NP-hardness, Discrete-continuous hybridization, Multi-objective resolution.
16th September 2013 CPSolvers 2013 Choco 18 / 22

Dealing with real world problems

Discussion

Few feedbacks from users only when they have trouble modeling a problem, or when there is a bug. BSD license Academic inconvenience Cannot provide professional support (heavy administration), Not interested in turnkey project (SQL, HMI) : AIMMS ?

16th September 2013

CPSolvers 2013 Choco

19 / 22

The future of Choco

Outline

1 The Choco constraint solver 2 Inside Choco 3 Dealing with real world problems 4 The future of Choco

16th September 2013

CPSolvers 2013 Choco

20 / 22

The future of Choco

Current hot topics inside Choco

Explanations :
User-oriented explanations SAT Solver interaction

Discrete-continuous bridge in practice Parallelization / distribution Robotic applications (Ibex)

16th September 2013

CPSolvers 2013 Choco

21 / 22

The future of Choco

Acknowledgements

Thank you for your attention !


Fathers Founding fathers : Fran cois Laburthe (Amadeus), Narendra Jussien (EMN, LINA) Funding fathers : Ecole des Mines de Nantes, (Bouygues SA, Amadeus SA)

16th September 2013

CPSolvers 2013 Choco

22 / 22