28
1/28 JJ II J I Back Close Solvers in CSP Search and Solvers in Constraint Programming Claudio Cesar de S´ a UDESC/DCC Joinville, March 14, 2011

Solvers and Applications with CP

  • Upload
    iaudesc

  • View
    945

  • Download
    1

Embed Size (px)

DESCRIPTION

Um seminário do Prof Claudio

Citation preview

Page 1: Solvers and Applications with CP

1/28

JJIIJI

Back

Close

Solvers in CSP

Search and Solvers inConstraint Programming

Claudio Cesar de SaUDESC/DCCJoinville, March 14, 2011

Page 2: Solvers and Applications with CP

2/28

JJIIJI

Back

Close

Contents

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

Page 3: Solvers and Applications with CP

3/28

JJIIJI

Back

Close

9 A Conjecture 26

10 Conclusions 27

11 Final Remarks 28

Page 4: Solvers and Applications with CP

4/28

JJIIJI

Back

Close

Page 5: Solvers and Applications with CP

5/28

JJIIJI

Back

Close

Introduction

The France

Page 6: Solvers and Applications with CP

6/28

JJIIJI

Back

Close

Auvergne Region

Page 7: Solvers and Applications with CP

7/28

JJIIJI

Back

Close

Universite d’Auvergne

• Many faculties and instituts

• IUT – Institut Universitaire de Technologie

• Many labs (CNRS, INRIA, ...)

• LAIC - (vanished in August/2011);

• On the other side of street: Universite Blaise Pascal, in 2012 willbe together with Universite d’Auvergne.

Page 8: Solvers and Applications with CP

8/28

JJIIJI

Back

Close

Fundamental Concepts on CPø 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 cantake

í Resuming, each variable xi has a non-empty domain Di of pos-sible values, and its goal to find a consistent set for these xisvariables under their domains.

í The CSP problems are attack by theConstraint Programming (CP) (known as CP area)

Page 9: Solvers and Applications with CP

9/28

JJIIJI

Back

Close

í 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-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 ....

Page 10: Solvers and Applications with CP

10/28

JJIIJI

Back

Close

Characteristics of Constraint Program-mingø 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

Page 11: Solvers and Applications with CP

11/28

JJIIJI

Back

Close

ø 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

ï 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)

Page 12: Solvers and Applications with CP

12/28

JJIIJI

Back

Close

ExampleGraph 3-colourability. For a graph G := (V,E) we generate a

CSP 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.

yy yr

g b

The CSP admits two other formulations, one as the model-checkingproblem for existential conjuctive-positive First-Order Logic, andone as the homomorphism problem (other seminar).

Page 13: Solvers and Applications with CP

13/28

JJIIJI

Back

Close

The Constraint Programming Processí Whose are the requirements to work?

ñ Constraint Modeling: Representations of a problem as a constraintsatisfaction problem with constraints is called constraint model-ing.

ñ Constraint Solving: Solving the constraint models formulated bymodeling can be carried out using any of the three methods:

ï Domain specific method 5 (Simplex, Grobner bases, etc.)

ï General Method 5 (Constraint propagation)

ï Combination of both methods (Solver cooperation)

Page 14: Solvers and Applications with CP

14/28

JJIIJI

Back

Close

Domain Specific Methods

ñ Special purpose algorithms devoted to specific domains and con-straints

ñ Method by means of specialized packages called constraint solvers

ñ Examples include:

ï Program that solves systems of linear equations

ï Package for linear programming

ï Implementation of unification algorithm

Page 15: Solvers and Applications with CP

15/28

JJIIJI

Back

Close

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 specificsearch methods

This encompasses two different methods/approaches:

ñ Constraint Propagation Algorithm

ï Algorithm that repeatedly removes inconsistent values from thedomains

ï 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

Page 16: Solvers and Applications with CP

16/28

JJIIJI

Back

Close

ï Heuristics schemes such: simulated annealing, tabu search, hill-climbing ...

Page 17: Solvers and Applications with CP

17/28

JJIIJI

Back

Close

SearchBasically, 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) andevolutionary algorithms (ags, swarm, genetic programming, ... )

ñ Common point: any warranty about its completeness, why?

Page 18: Solvers and Applications with CP

18/28

JJIIJI

Back

Close

Our Metaphore for Search in CP

Figure 1: crab computation

Page 19: Solvers and Applications with CP

19/28

JJIIJI

Back

Close

Our Real Situation in Interesting Problems

Figure 2: A hard and real situation

Page 20: Solvers and Applications with CP

20/28

JJIIJI

Back

Close

Solvers and Lybraries for CPñ 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

• ....

Page 21: Solvers and Applications with CP

21/28

JJIIJI

Back

Close

ñ Lybraries: A library that extends a programming language or iscalled by another programming system.

Page 22: Solvers and Applications with CP

22/28

JJIIJI

Back

Close

C++ based Constraint Solvers

ñ MINION* http://minion.sourceforge.net/reference.html* Cygwin (MS Windows), All POSIX (Linux/BSD/UNIX-like OSes),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

Page 23: Solvers and Applications with CP

23/28

JJIIJI

Back

Close

PROLOG-based Constraint Solvers

ñ CHIP V5, the Second-Generation Constraint Programming tool* http://www.cosytec.com/production scheduling/chip/optimization product chip.htm* UNIX, Linux and Windows NT/2000* Availability: Commercial

ñ GNU Prolog* http://sourceforge.net/projects/gprolog* All 32-bit MS Windows (95/98/NT/2000/XP), All POSIX (Linux/BSD/UNIX-like OSes), Other Operating Systems* Availability: Free

ñ Eclipse* http://eclipseclp.org/* Availability: Free

Page 24: Solvers and Applications with CP

24/28

JJIIJI

Back

Close

Java-based Solvers

ñ KOALOG* http://www.koalog.com/php/jcs.php* Windows, Windows 2000/XP, LINUX* 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

Page 25: Solvers and Applications with CP

25/28

JJIIJI

Back

Close

What’s Missing?ø Functional paradigm is not ready yet ... although it is direct in

programming languages such: Haskell

ø Any interface for any lybrary was implemented under functionalparadigm

ø 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.

Page 26: Solvers and Applications with CP

26/28

JJIIJI

Back

Close

A Conjecture

CP

classic

Agent #1

Evolutive

Agent #2

Page 27: Solvers and Applications with CP

27/28

JJIIJI

Back

Close

Conclusions1. 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

Page 28: Solvers and Applications with CP

28/28

JJIIJI

Back

Close

Final Remarks

ø Thanks for your attention

ø Questions?

ø Time for the coffe