Solvers and Applications with CP


Published on

Um seminário do Prof Claudio

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Solvers and Applications with CP

  1. 1. Solvers in CSP 1/28Search and Solvers inConstraint ProgrammingClaudio Cesar de S´ aUDESC/DCCJoinville, March 14, 2011 Back Close
  2. 2. Contents 2/281 Introduction 52 Fundamental Concepts on CP 83 Characteristics of Constraint Programming 104 Example 125 The Constraint Programming Process 136 Search 177 Solvers and Lybraries for CP 208 What’s Missing? 25 Back Close
  3. 3. 9 A Conjecture 2610 Conclusions 2711 Final Remarks 28 3/28 Back Close
  4. 4. 4/28BackClose
  5. 5. IntroductionThe France 5/28 Back Close
  6. 6. Auvergne Region 6/28 Back Close
  7. 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. 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. 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. 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. 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. 12. Example 12/28 Graph 3-colourability. For a graph G := (V, E) we generate aCSP with variables V := {v1, v2, ..., vn}, values D := {r, g, b} andconstraints: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 bThe CSP admits two other formulations, one as the model-checkingproblem for existential conjuctive-positive First-Order Logic, andone as the homomorphism problem (other seminar). Back Close
  13. 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. 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. 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. 16. ¶ Heuristics schemes such: simulated annealing, tabu search, hill- climbing ... 16/28 Back Close
  17. 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. 18. Our Metaphore for Search in CP 18/28 Figure 1: crab computation Back Close
  19. 19. Our Real Situation in Interesting Problems 19/28 Figure 2: A hard and real situation Back Close
  20. 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. 21. É Lybraries: A library that extends a programming language or iscalled by another programming system. 21/28 Back Close
  22. 22. C++ based Constraint SolversÉ MINION * * Cygwin (MS Windows), All POSIX (Linux/BSD/UNIX-like OSes), 22/28 OS X * Availability: FreeÉ ILOG Solver * * IRIX 6.5 (System V-based Unix operating system with BSD ex- tensions) * Availability: CommercialÉ GeCode- Generic Constraint development Environment * * Windows and BSD style * Availability: Free Back Close
  23. 23. PROLOG-based Constraint SolversÉ CHIP V5, the Second-Generation Constraint Programming tool * scheduling/chip/optimization product * UNIX, Linux and Windows NT/2000 23/28 * Availability: CommercialÉ GNU Prolog * * All 32-bit MS Windows (95/98/NT/2000/XP), All POSIX (Linux/BSD/UNI like OSes), Other Operating Systems * Availability: FreeÉ Eclipse * * Availability: Free Back Close
  24. 24. Java-based SolversÉ KOALOG * * Windows, Windows 2000/XP, LINUX 24/28 * Availability: CommercialÉ Choco * * UNIX * Availability: FreeÉ DragonBreath Engine * * OS Independent (Written in an interpreted language) * Availability: FreeÉ Temporal Constraint Solver * * OS Independent (Written in an interpreted language) * Availability: Free Back Close
  25. 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. 26. A Conjecture 26/28 Agent #1 Agent #2 CP Evolutive classic Back Close
  27. 27. Conclusions 27/281. Build new solvers? No2. Explore the massive computation? Yes3. Investigation on news representation and paradigm on its computa- tion? Yes4. For example: Haskell is mature ... well accepted Back Close
  28. 28. Final Remarks 28/28º Thanks for your attentionº Questions?º Time for the coffe Back Close