Hybrid CSP Solving - FJCP 2005

domains over which variables can range (D = D1. ×...×Dn). DX1. = {a;b;c;...} ... DXn = {t;u;v;...} some constraints to set relation between objects. C1. : X ≤ Y ∗ 3.
792KB taille 5 téléchargements 313 vues
Hybrid CSP Solving Frédéric Saubion LERIA, Université d’Angers Joint work with Eric Monfroy (LINA, U. Nantes and UTFSM, Valparaiso, Chile) Tony Lambert (LERIA, U. Angers and LINA U. Nantes)

Problems are modeled as CSPs (X, D, C) some variables to represent objects (X = {X1 , . . . , Xn }) domains over which variables can range (D = D1 × . . . × Dn ) DX1 = {a; b; c; . . . } ... DXn = {t; u; v; . . . } some constraints to set relation between objects C1 : X ≤ Y ∗ 3 C2 : Z 6= X − Y ...

Hybrid Constraint Solving – p. 8

Complete/incomplete methods complete methods (such as propagation + split) complete exploration of the search space detect if no solution global optimum generally slow for hard combinatorial problems incomplete methods (such as local search) focus on some “promising” parts of the search space do not detect if no solution no global optimum “fast” to find a “good” solution Hybrid Constraint Solving – p. 46

CSP solving with a complete method

Constraint Propagation

Enumeration Splitting

Hybrid Constraint Solving – p. 15

Constraint propagation mechanism repeated application of reductions try to apply only useful reductions stop when a local consistency notion is reached (e.g., arc, node, hyper-arc consitency) or when reduction becomes inefficient (e.g., cycling weak reductions) or when a domain is empty (failed CSP)

Hybrid Constraint Solving – p. 18

Local search

Hybrid Constraint Solving – p. 34

Local search (1) Search space: set of possible configurations Tools: neighborhood and evaluation function Neighborhood of s

Set of possible configurations

s s

1

s

3

s

4

s 2

s

6

5

Hybrid Constraint Solving – p. 35

Local search (2) Search space: set of possible configurations Tools: neighborhood and evaluation function Neighborhood of s

Set of possible configurations

s s

1

s

3

s

4

s 2

s

6

5

Hybrid Constraint Solving – p. 36

Local search (3) Search space: set of possible configurations Tools: neighborhood and evaluation function Neighborhood of s

Set of possible configurations

s s

1

s

3

s

4

s 2

s

6

5

Hybrid Constraint Solving – p. 37

Local search (4) Search space: set of possible configurations Tools: neighborhood and evaluation function

Neighborhood of s

Set of possible configurations LS(p) = p’

s s

1

s

3

s

4

s 2

s

p=(

s

1

, s

2

, ...,

s

n

)

p’ = (

s

1

, s

2

, ...,

s

n

, s

n+1

)

6

5

Hybrid Constraint Solving – p. 38

Genetic algorithms

Hybrid Constraint Solving – p. 39

Genetic algorithms (1) Search space: set of possible configurations Tools: population, crossing, mutations, and evaluation function

Population

Hybrid Constraint Solving – p. 40

Genetic algorithms (2) Search space: set of possible configurations Tools: population, crossing, mutations, and evaluation function Set of possible configurations Population

Hybrid Constraint Solving – p. 41

Genetic algorithms (3) Search space: set of possible configurations Tools: population, crossing, mutations, and evaluation function Population k

x

1

4

9

4

2

5

y

Population k+1 1

8

4

2

4

6

2

4

2

1

9

9

Hybrid Constraint Solving – p. 42

Genetic algorithms (4) Search space: set of possible configurations Tools: population, crossing, mutations, and evaluation function Population k

x

1

4

9

4

2

1

4

9

4

8

5

y

5

Population k+1

Hybrid Constraint Solving – p. 43

Genetic algorithms (5) Search space: set of possible configurations Tools: population, crossing, mutations, and evaluation function

Population k

Crossing

Mutation Population k+1

New Population

Hybrid Constraint Solving – p. 44

Hybridization: getting the best of the both Efficiency: faster complete solver Quality: better solutions (better optimum) Generally: Ad-hoc systems (designed from scratch) Dedicated to a class of problems Master-slave approaches (LS for CP, CP for LS) Coarse grain cooperations Idea: fine grain hybridization finer strategies every technique at the same level one algorithm squeleton easier to modify, extend, compare, ... Hybrid Constraint Solving – p. 47

Hybrid solving

Hybrid Constraint Solving – p. 53

Abstract model K.R. Apt [CP99] for propagation (based on chaotic iterations) Abstraction Reduction functions

Constraint

Application of functions

CSP

Fixed point Partial Ordering

Hybrid Constraint Solving – p. 55

A Generic Algorithm: propagation for constraint propagation: ordering on size of domains work on a CSP F = { set of propagation functions} X = initial CSP G=F While G 6= ∅ choose g ∈ G G = G − {g} G = G ∪ update(G, g, X) X = g(X) EndWhile

Hybrid Constraint Solving – p. 56

Idea1: integrate split in GI avoid the CP framework algorithm split and reduction at the same level work on union of CSP

Hybrid Constraint Solving – p. 57

Theoretical model for CSP solving (1) Partial ordering:

Ω1 Application of a reduction : domain reduction function or splitting function

Set of CSP

Ω2

Ω3 Ω4 Ω5

Terminates with a fixed point : set of solutions or inconsistent CSP Hybrid Constraint Solving – p. 59

Theoretical model for CSP solving (2) Reduction: by constraint propagation:



Ω’ Ω

CSP1

CSP2

CSP3

Constraint Propagation



CSP1

CSP2’

CSP3

Hybrid Constraint Solving – p. 60

Theoretical model for CSP solving (3) Reduction by domain splitting:



Ω’ Ω

CSP1

CSP2

CSP3

Split



CSP1

CSP2’

CSP2’’

CSP2’’’

CSP3

Hybrid Constraint Solving – p. 61

CP + LS

Hybrid Constraint Solving – p. 62

Idea2: LS as moves on partial ordering LS moves on a partial ordering: p

Function to pass from one LS state to another p

1

2

State of LS p 3

p 4

p 5

Terminates with a fixed point : local minimum, maximum number of iteration Hybrid Constraint Solving – p. 63

Idea3: integrate samples for LS A sample: Depends on a CSP Corresponds to a LS state an SCSP contains (LS+domain reduction): A set of domains; A (list of) sample for local search (a LS path). an σCSP contains (LS+domain reduction+split): A set of SCSP

Hybrid Constraint Solving – p. 65

Theoretical model for hybridization (3) Ω1

Ordering over σCSP Application of a reduction : function : − domain reduction, − splitting, − or LS step.

Ω2 Ω3

Set of SCSP

Ω4 Ω5 A solution before the end of the process, given by LS Terminates with a fixed point : set of solutions or inconsistent SCSP Hybrid Constraint Solving – p. 66

Algorithm Always the GI algorithm In the chaotic iteration framework Finite domains (sets of SCSP) Monotonic functions (LS move, domain reduction, splitting) Decreasing functions → termination and computation of fixed point (solution of CP) Practically: can stop before with a LS solution

Hybrid Constraint Solving – p. 67

A Generic Algorithm: hybrid solving for hybrid CP+LS constraint solving F = { set of split, propagation, and LS functions} X = initial CSP G=F While G 6= ∅ choose g ∈ G G = G − {g} G = G ∪ update(G, g, X) X = g(X) EndWhile

Hybrid Constraint Solving – p. 68

General process CP+LS

Constraint

Sets of SCSP

Application of functions

LS solution Global Fixed point

Hybrid Constraint Solving – p. 69

Strategies: ratio LS-CP Ratio of LS and CP functions applied: (red%,split%,ls%) 10% of split compared to reduction CP alone: (90,10,0) LS alone: (0,0,100) LS strategy: tabu Choose: LS, reduction, or split but keep the given ratios

Hybrid Constraint Solving – p. 71

SEND + MORE = MONEY 2000

1800

Number of operations

1600

1400

1200 standard deviation 1000

800

600 Average 400

200 10

20

30

40

50

60

70

80

90

100

Propagation percentage Hybrid Constraint Solving – p. 73

Ranges Problem

S+M

LN42

Zebra

M. square

Golomb

Rate FC 70-80 15 - 25 60-70 30-45 30 - 40 Best range of propagation rate (α) to compute a solution

Strategy

Method

S+M

LN42

M. square

Golomb

Random

LS

1638

383

3328

3442

CP+LS

1408

113

892

909

CP

3006

1680

1031

2170

LS

1535

401

3145

3265

CP+LS

396

95

814

815

CP

1515

746

936

1920

LS

1635

393

3240

3585

CP+LS

22

192

570

622

CP

530

425

736

1126

D-First

FC

Avg. nb. of operations to compute a first solution Hybrid Constraint Solving – p. 74

CP + GA

Hybrid Constraint Solving – p. 75

Theoretical model for hybridization CP+GA(3) Ω1

Ordering over OGCSPs Application of a reduction: function: − domain reduction

Ω2

− split − or GA.

Ω3

set of ogCSP

Ω4 Ω5 an optimal solution given by GA before the end of the process fixed point: set of solutions or inconsistency Hybrid Constraint Solving – p. 79

Algorithm Always the GI algorithm In the chaotic iteration framework Finite domains (set of OGCSP) Monotonic functions (GA move, domain reduction, splitting) Decreasing functions → termination and computation of fixed point (solution of CP) Practically: can stop before with an optimum for GA

Hybrid Constraint Solving – p. 80

A Generic Algorithm: hybrid solving me again!!! for hybrid CP+GA constraint solving F = { set of split, propagation, and GA functions} X = initial OGCSP G=F While G 6= ∅ choose g ∈ G G = G − {g} G = G ∪ update(G, g, X) X = g(X) EndWhile

Hybrid Constraint Solving – p. 81

General process CP+GA

Constraints

Set of ogCSP

optimal solution through AG

Application of functions

Global fixed point

Hybrid Constraint Solving – p. 82

Application BACP (to optimize loads of periods Lectures e

c f

Max Min

h d

b

i

j

k

g

a

d

Constraints

h

k

i

e

c

f

g

a

a before b "j c" h" "b i " "f f" "j k" "c d" "e

j b

Periods Hybrid Constraint Solving – p. 83

BACP8 100

range

80

propagation genetic algorithm split

60 40 20 0 25 24 23 22 21 20 19 18 17 16 evaluation Hybrid Constraint Solving – p. 85

BACP10 100

propagation genetic algorithm split

range

80 60 40 20 0 24

22

20

18

16

14

12

evaluation Hybrid Constraint Solving – p. 86

BACP12 100

propagation genetic algorithm split

range

80 60 40 20 0 25

24

23

22

21

20

19

18

17

evaluation Hybrid Constraint Solving – p. 87

Conclusion

A generic model for hybridizing complete (CP) and incomplete (LS and GA) methods Implementation of modules working on the same structure Complementarity of methods: hybridization Design of strategies

Hybrid Constraint Solving – p. 88

Future

Constraint programming = modelling tools + computation strategy + search strategy + solvers synergies between: complete + incomplete methods, CP + AI + OR + . . . learning strategies providing more tools in a generic environment

Hybrid Constraint Solving – p. 89