2024: Domino Containers - The Next Step. News from the Domino Container commu...
Solvers and Applications with CP
1. Solvers in CSP
1/28
Search and Solvers in
Constraint Programming
Claudio Cesar de S´
a
UDESC/DCC
Joinville, March 14, 2011
Back
Close
2. Contents
2/28
1 Introduction 5
2 Fundamental Concepts on CP 8
3 Characteristics of Constraint Programming 10
4 Example 12
5 The Constraint Programming Process 13
6 Search 17
7 Solvers and Lybraries for CP 20
8 What’s Missing? 25
Back
Close
3. 9 A Conjecture 26
10 Conclusions 27
11 Final Remarks 28 3/28
Back
Close
7. Universit´ d’Auvergne
e
• Many faculties and instituts
• IUT – Institut Universitaire de Technologie
7/28
• Many labs (CNRS, INRIA, ...)
• LAIC - (vanished in August/2011);
• On the other side of street: Universit´ Blaise Pascal, in 2012 will
e
be together with Universit´ d’Auvergne.
e
Back
Close
8. Fundamental Concepts on CP
8/28
º The Constraint Satisfaction Problem (CSP) is defined by a set of
variables which must be satisfied under a set of the domain
º Constraint Satisfaction Problem (CSP) consists of:
µ Finite set of variables x1 , x2 , . . . ,xn
µ For each variable xi , a finite set Di of possible values (its domain)
µ Set of constraints restricting the values that the variables can
take
µ Resuming, each variable xi has a non-empty domain Di of pos-
sible values, and its goal to find a consistent set for these xis
variables under their domains.
µ The CSP problems are attack by the
Constraint Programming (CP) (known as CP area)
Back
Close
9. µ Once CSP is represented, solving process include:
¶ Determining whether the CSP has a solution (check for con-
sistency)
¶ Finding a solution: a solution to a CSP is a complete consis-
9/28
tent assignment of variables
¶ Finding all solutions
¶ Finding an optimal solution
¶ Finding all optimal solutions
¶ Finding a good solution
° This discussion will be resumed later ....
Back
Close
10. Characteristics of Constraint Program-
ming 10/28
º Declarative programming – modeling
º Flexible representation – constraints can be added, removed or mod-
ified
º A two phase programming approach:
É Generation of a problem representation as a CSP
É Finding a solution of the CSP
Back
Close
11. º Presence of built-in (embeeded ) mechanisms such:
¶ Constraints can be added, removed or modified
¶ Features to declare and define variables
¶ Features to generate constraints over the variables 11/28
¶ Constraint solvers
¶ Constraint propagation algorithm
¶ Search techniques
In steps, basically, the CP consists of three basic steps:
º Declaring the domains of the variables
º Declaring the constraints on the declared variables
º Searching for the solutions (search, constraint and propagation)
Back
Close
12. Example
12/28
Graph 3-colourability. For a graph G := (V, E) we generate a
CSP with variables V := {v1, v2, ..., vn}, values D := {r, g, b} and
constraints:
C := {(vi, vj , {r, g, b}2 {(r, r), (g, g), (b, b)}) : for each (vi, vj ) ∈ E}
Note that {r, g, b}2 {(r, r), (g, g), (b, b)} is the triangle K3.
r y
g y y b
The CSP admits two other formulations, one as the model-checking
problem for existential conjuctive-positive First-Order Logic, and
one as the homomorphism problem (other seminar).
Back
Close
13. The Constraint Programming Process
13/28
µ Whose are the requirements to work?
É Constraint Modeling: Representations of a problem as a constraint
satisfaction problem with constraints is called constraint model-
ing.
É Constraint Solving: Solving the constraint models formulated by
modeling can be carried out using any of the three methods:
¶ Domain specific method 5 (Simplex, Gr¨bner bases, etc.)
o
¶ General Method 5 (Constraint propagation)
¶ Combination of both methods (Solver cooperation)
Back
Close
14. Domain Specific Methods
É Special purpose algorithms devoted to specific domains and con-
straints
É Method by means of specialized packages called constraint solvers 14/28
É Examples include:
¶ Program that solves systems of linear equations
¶ Package for linear programming
¶ Implementation of unification algorithm
Back
Close
15. General Methods
É Can be used for several different types of constraints and domains
(of the variables)
É Concerned with the ways of reducing the search space with specific 15/28
search methods
This encompasses two different methods/approaches:
É Constraint Propagation Algorithm
¶ Algorithm that repeatedly removes inconsistent values from the
domains
¶ Reduces the search space
¶ Maintain equivalence while simplifying the problem
¶ Achieve various forms of local consistency
É Search Methods
¶ Explores the search space – a tree search is built
¶ Consists of combination of constraint propagation, backtrack,
branch and bound search Back
Close
16. ¶ Heuristics schemes such: simulated annealing, tabu search, hill-
climbing ...
16/28
Back
Close
17. Search
17/28
Basically, two types:
¶ Systematic or rigid schemes: dfs, bs, tabu search, ... (none consid-
eration about the entropy during the search)
¶ Heuristics schemes such: simulated annealing, tabu search, hill-
climbing, ... (some consideration on entropy – randonness) and
evolutionary algorithms (ags, swarm, genetic programming, ... )
É Common point: any warranty about its completeness, why?
Back
Close
18. Our Metaphore for Search in CP
18/28
Figure 1: crab computation
Back
Close
19. Our Real Situation in Interesting Problems
19/28
Figure 2: A hard and real situation
Back
Close
20. Solvers and Lybraries for CP
20/28
É Solvers:
• Java-based constraint solvers
• C-based constraint solvers
• C++ -based constraint solvers
• C, C++, Python and Tcl based constraint solvers
• C++/Java/Python/Scheme and Smalltalk-based constraint solvers
• Python-based constraint solvers
• PROLOG-based constraint solvers
• VB.NET-based constraint solvers
• Mozart-Oz-based constraint solvers
• .... Back
Close
21. É Lybraries: A library that extends a programming language or is
called by another programming system.
21/28
Back
Close
22. C++ based Constraint Solvers
É MINION
* http://minion.sourceforge.net/reference.html
* Cygwin (MS Windows), All POSIX (Linux/BSD/UNIX-like OSes), 22/28
OS X
* Availability: Free
É ILOG Solver
* http://www.ilog.com/
* IRIX 6.5 (System V-based Unix operating system with BSD ex-
tensions)
* Availability: Commercial
É GeCode- Generic Constraint development Environment
* http://www.gecode.org/
* Windows and BSD style
* Availability: Free
Back
Close
23. PROLOG-based Constraint Solvers
É CHIP V5, the Second-Generation Constraint Programming tool
* http://www.cosytec.com/production scheduling/chip/optimization product
* UNIX, Linux and Windows NT/2000 23/28
* Availability: Commercial
É GNU Prolog
* http://sourceforge.net/projects/gprolog
* All 32-bit MS Windows (95/98/NT/2000/XP), All POSIX (Linux/BSD/UNI
like OSes), Other Operating Systems
* Availability: Free
É Eclipse
* http://eclipseclp.org/
* Availability: Free
Back
Close
24. Java-based Solvers
É KOALOG
* http://www.koalog.com/php/jcs.php
* Windows, Windows 2000/XP, LINUX 24/28
* Availability: Commercial
É Choco
* http://choco.sourceforge.net/
* UNIX
* Availability: Free
É DragonBreath Engine
* http://sourceforge.net/projects/dragonbreath
* OS Independent (Written in an interpreted language)
* Availability: Free
É Temporal Constraint Solver
* http://sourceforge.net/projects/tcsolver
* OS Independent (Written in an interpreted language)
* Availability: Free
Back
Close
25. What’s Missing?
25/28
º Functional paradigm is not ready yet ... although it is direct in
programming languages such: Haskell
º Any interface for any lybrary was implemented under functional
paradigm
º Distributed computation is a challenge in CP
º Under multi-core processor a new-paradigm for CP
º Adaptation in CP systems are unknow yet
º Finally, the hybridization was not reached with meaningful success.
Back
Close
26. A Conjecture
26/28
Agent #1 Agent #2
CP Evolutive
classic
Back
Close
27. Conclusions
27/28
1. Build new solvers? No
2. Explore the massive computation? Yes
3. Investigation on news representation and paradigm on its computa-
tion? Yes
4. For example: Haskell is mature ... well accepted
Back
Close
28. Final Remarks
28/28
º Thanks for your attention
º Questions?
º Time for the coffe
Back
Close