61
Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona Spain

Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

Soft constraint processing

Thomas SchiexINRA – ToulouseFrance

Pedro MeseguerCSIC – IIIA – BarcelonaSpain

Special thanks to:Javier LarrosaUPC – BarcelonaSpain

Page 2: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-2

Overview

Introduction and definitions Why soft constraints and dedicated

algorithms? Generic and specific models

Solving soft constraint problems By search (systematic and local) By complete inference… and search By incomplete inference… and search

Existing implementations

Page 3: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-3

Why soft constraints?

CSP framework: for decision problems Many problems are optimization

problems

Economics (combinatorial auctions) Given a set G of goods and a set B of

bids… Bid (Bi , Vi ), Bi requested goods, Vi value

… find the best subset of compatible bids

Best = maximize revenue (sum)

Page 4: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-4

Why soft constraints?

Satellite scheduling Spot 5 is an earth observation satellite It has 3 on-board cameras Given a set of requested pictures (of

different importance)… Resources, data-bus bandwidth, setup-

times, orbiting

…select a subset of compatible pictures with max. importance (sum)

Page 5: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-5

Why soft constraints

Multiple sequence alignment (DNA,AA)

Given k homologous sequences… AATAATGTTATTGGTGGATCGATGA ATGTTGTTCGCGAAGGATCGATAA

… find the best alignment (sum) AATAATGTTATTGGTG---GATCGATGATTA ----ATGTTGTTCGCGAAGGATCGATAA---

Page 6: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-6

Why soft constraints?

Probabilistic inference (bayesian nets) Given a probability distribution defined

by a DAG of conditional probability tables And some evidence

…find the most probable explanation for the evidence (product)

Page 7: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-7

Why soft constraints?

Ressource allocation (frequency assignment) Given a telecommunication network …find the best frequency for each

communication link

Best can be: Minimize the maximum frequency (max) Minimize the global interference (sum)

Page 8: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-8

Why soft constraints

Even in decision problems, the user may have preferences among solutions.

It happens in most real problems.

Experiment: give users a few solutions and they will find reasons to prefer some of them.

Page 9: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-9

Overview

Introduction and definitions Why soft constraints and dedicated algorithms? Generic and specific models

Solving soft constraint problems By search (systematic and local) By complete inference… and search By incomplete inference… and search

Existing implementations

Page 10: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-10

Soft constraints

Two new difficulties: How to express preferences in the

model? How to solve the resulting optimization

problem?

Page 11: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-11

Solving soft constraints as a CSP

Using a global criteria constraint New constraint Sk on all X

Sk(X) = criteria value must be more than k Number of variables having value blue

Apply:

k := nRepeat

solve the original problem Sk(X) k:=k-1;Until solution

n-ary constraintInefficient!!

Page 12: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-12

Combined local preferences

Constraints are local cost functions Costs combine with a dedicated

operator max: priorities +: additive costs *: factorized probabilities…

Goal: find an assignment with the optimal combined cost

Fuzzy/min-max CSP

Weighted CSP

Probabilistic CSP, BN

Page 13: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-13

Soft constraint network

(X,D,C) X={x1,..., xn} variables D={D1,..., Dn} finite domains C={c1,..., ce} cost functions

var(ci) scope ci(t): E (ordered cost domain, T, )

Obj. Function: F(X)= ci (X) Solution: F(t) T Soft CN: find minimal cost solution

identityannihilator

• commutative• associative• monotonic

Page 14: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-14

Semiring CSP

Valued CSP and Semiring CSP

Valued CSP(total order)

Page 15: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-15

Specific frameworks

E = {t,f} = and classical CSP E = [0,1] = max fuzzy CSP E = N = + weighted

CSP E = [0,1] = * bayesian net

Lexicographic CSP, probabilistic CSP…

Page 16: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-16

Weighted CSP example ( = +)

x3

x2

x5

x1 x4

F(X): number of non blue vertices

For each vertex

For each edge:

xi c(xi

)

b 0

g 1

r 1

xi xj c(xi,x

j)

b b T

b g 0

b r 0

g b 0

g g T

g r 0

r b 0

r g 0

r r T

Page 17: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-17

Fuzzy constraint network (=max)

x3

x2

x5

x1 x4

F(X): highest color used (b<g<r<y)

For each vertex

Connected vertices musthave different colors

xi c(xi

)

b 0.2

g 0.4

r 0.6

y 0.8

Page 18: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-18

Some insight in unusual items

T = maximum violation. Can be set to a bounded max. violation k Solution: F(t) < k = Top

Empty scope soft constraint c (a constant) Gives an obvious lower bound on the optimum If you do not like it: c =

Additional expression power

Page 19: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-19

Weighted CSP example ( = +)

x3

x2

x5

x1 x4

F(X): number of non blue vertices

For each vertex

For each edge:

xi c(xi

)

b 0

g 1

r 1

xi xj c(xi,x

j)

b b T

b g 0

b r 0

g b 0

g g T

g r 0

r b 0

r g 0

r r T

T=6c = 0T=3

Optimal coloration with less than 3 non-blue

Page 20: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-20

Microstructural graph

0 1 1

b g r

x5

x4

x2

x1

x3

T=6c=0

0 1 1

0 1 1

0 1 1 0 1 1

6 6 6

Page 21: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-22

Basic operations on cost functions

I. Assignment (conditioning)

II. Combination (join)

III. Projection (elimination)

Page 22: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-23

Assignment (conditioning)

xi xj c(xi,x

j)

b b T=6

b g 0

b r 0

g b 0

g g T=6

g r 0

r b 0

r g 0

r r T=6

Assign(c,xi,b)

xj

b T=6

g 0

r 0f(xj)

Assign(f,xj,g)

0

h

Page 23: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-24

Combination (join with )

xi xj c(xi,x

j)

b b 6

b g 0

g b 0

g g 6

xj xk c(xj,xk

)

b b 6

b g 0

g b 0

g g 6

xi xj xk f(xi,xj,xk

)

b b b 12

b b g 6

b g b 0

b g g 6

g b b 6

g b g 0

g g b 6

g g g 12

= 0 6

Page 24: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-25

Projection (elimination)

xi xj c(xi,x

j)

b b 4

b g 6

b r 0

g b 2

g g 6

g r 3

r b 1

r g 0

r r 6

Elim(c,xj) xi f(xi)

b

g

r

0

0

2

Elim(f,xi)h

0

Min

Page 25: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-26

Overview

Introduction and definitions Why soft constraints and dedicated algorithms? Generic and specific models

Solving soft constraint problems By search (systematic and local) By complete inference… and search By incomplete inference… and search

Existing implementations

Page 26: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-27

Systematic search

(LB) Lower Bound

(UB) Upper Bound

If UB then prune

vari

ab

les

under estimation of the best solution in the sub-tree

= best solution so far

Each node is a soft constraint subproblem

cLB

= c

= T

Page 27: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-28

Assigning x3

x3

x2

x5

x1 x4

x2

x5

x1 x4x2

x5

x1 x4x2

x5

x1 x4

Page 28: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-29

T

Assign g to X

0

x5

x4

x2

x1

x3

T=6c=

0

6 66

b g r

1 1

01

1 1 0 1 1

0 1 1

0 1 1

T T

b g r

34

T

Backtrack

Page 29: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-30

Depth First Search (DFS)

BT(X,D,C)if (X=) then Top :=c

else xj := selectVar(X)

forall aDj do

cC s.t. xj var(c) c:=Assign(c, xj ,a)

c:= cC s.t. var(c)= c

if (LB<Top) then BT(X-{xj},D-{Dj},C)

Heuristics

Improve LB

Good UB ASAP

Page 30: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-31

Improving the LB

Assigned constraints (c) Original constraints

Solve

Optimal cost c

• Gives a stronger LB• Can be solved beforehand

Page 31: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-32

Russian Doll Search

static variable ordering

solves increasingly large subproblems

uses previous LB recursively

May speedup search by several orders of magnitude

X1

X2

X3

X4

X5

Page 32: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-33

Local search

Based on perturbation of solutions in a local neighborhood

Simulated annealing Tabu search Variable neighborhood search Greedy rand. adapt. search (GRASP) Evolutionary computation (GA) Ant colony optimization…

See: Blum & Roli, ACM comp. surveys, 35(3), 2003

Page 33: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-34

Boosting Systematic Search with Local Search

Local search

(X,D,C)

time limit

Sub-optimalsolution

Do local search prior systematic search Use best cost found as initial T

If optimal, we just prove optimality In all cases, we may improve pruning

Page 34: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-35

Boosting Systematic Search with Local Search

Ex: Frequency assignment problem Instance: CELAR6-sub4

#var: 22 , #val: 44 , Optimum: 3230 Solver: toolbar with default options UB initialized to 100000 3 hours UB initialized to 3230 1 hour

Local search can find the optimum in a few minutes

Page 35: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-36

Overview

Introduction and definitions Why soft constraints and dedicated algorithms? Generic and specific models

Solving soft constraint problems By search (systematic and local) By complete inference… and search By incomplete inference… and search

Existing implementations

Page 36: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-37

Variable elimination (aka bucket elimination)

Solves the problem by a sequence of problem transformations

Each step yields an equivalent problem with one less variable

When all variables have been eliminated, the problem is solved

Optimal solutions of the original problem can be recomputed

Page 37: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-38

C

Variable elimination

Select a variable Xi

Compute the set Ki of constraints that involves this variable

Add Elim( ) Remove variable and

Ki

Time: (exp(degi+1)) Space: (exp(degi))

X4

X3

X5

X2

X1

1, XciKc

Page 38: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-40

Variable elimination

Time: exponential in the size of the largest combination performed (1+induced width)

Space: similar !

Infeasible as a general method…

Page 39: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-41

Boosting search with variable elimination: BB-VE(k)

At each node Select an unassigned variable Xi

If degi ≤ k then eliminate Xi

Else branch on the values of Xi

Properties BE-VE(-1) is BB BE-VE(w*) is VE BE-VE(1) is like cycle-cutset

Page 40: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-42

Example BB-VE(2)

Page 41: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-43

Example BB-VE(2)

cc c

Page 42: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-44

Boosting search with variable elimination

Ex: still-life (academic problem) Instance: n=14

#var:196 , #val:2 Ilog Solver 5 days Variable Elimination 1 day BB-VE(18) 2 seconds

Page 43: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-45

Overview

Introduction and definitions Why soft constraints and dedicated algorithms? Generic and specific models

Solving soft constraint problems By search (systematic and local) By complete inference… and search By incomplete inference… and search

Existing implementations

Page 44: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-46

Local consistency

Local property enforceable in polynomial time yielding an equivalent and more explicit problem

Massive local (incomplete) inference

Very useful in classical CSP Node consistency Arc consistency…

Page 45: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-47

Classical arc consistency (binary CSP)

for any Xi and cij

f=Elim(cij ci cj,Xj) brings no new information on Xi

w

v v

w

0

0

0

0

i j

T

T

Xi Xj cij

v v 0

v w 0

w v T

w w T

Xi f(Xi)

v 0

w T

cij ci cj

Elim xj

T

Page 46: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-48

Arc consistency and soft constraints

for any Xi and cij

f=Elim(cij ci cj,Xj) brings no new information on Xi

w

v v

w

0

0

0

0

i j

2

1

Xi Xj cij

v v 0

v w 0

w v 2

w w 1

Xi f(Xi)

v 0

w 1

cij ci cj

Elim xj

1

EQUIVALENCE LOST …unless idempotent (fuzzy CSP)

Page 47: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-49

A parenthesis…Why min-max (fuzzy) CSP is easy

A new operation on soft constraints: The -cut of a soft constraint c is the

hard constraint c that forbids t iff c(t) >

Can be applied to a whole soft CN

xi xj c(xi,xj)

b b 0.6

b g 0.3

g b 0.1

g g 0.5

Cut(c, 0.4)xi xj c(xi,xj)

b b T

b g 0

g b 0

g g T

Page 48: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-50

Solving a min-max CSP by slicing

Let S be the set of all optimal solutions of a min-max CN

Let be the maximum s.t. the -cut is consistent. Then S is the set of solutions of the -cut.

A min-max (or fuzzy) CN can be solved in O(log(# different costs)) CSP.

Can be used to lift polynomial classes

Binary search

Page 49: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-51

Back to Weighted CSP andArc consistency

for any Xi and cij

f=Elim(cij ci cj,Xj) brings no new information on Xi

w

v v

w

0

0

0

0

i j

2

1

Xi Xj cij

v v 0

v w 0

w v 2

w w 1

Xi f(Xi)

v 0

w 1

cij ci cj

Elim xj

1

EQUIVALENCE LOST …unless idempotent (fuzzy CSP)

Page 50: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-52

Projection of cij on Xi with compensation

Equivalence preserving transformation Can be reversed Requires the existence of a pseudo

difference (a b) b = a

1

A new operation on soft networks

w

v v

w

0

0

0

i j1

0

Page 51: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-53

Node Consistency (NC*)

For all variable i a, C + Ci (a)<T a, Ci (a)= 0

Complexity:

O(nd)w

v

v

v

w

w

C =T =

32

2

11

1

1

1

0

0

1

x

y

z

0

0

014

Page 52: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-54

0

Arc Consistency (AC*)

NC*

For all Cij a b

Cij(a,b)= 0

b is a support complexity:

O(n 2d 3)

wv

v

w

w

C =T=4

2

11

1

0

0

0

0

1

x

y

z

1

12

0

Page 53: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-55

1

1

Directional AC (DAC*)

NC*

For all Cij (i<j) a b

Cij(a,b) + Cj(b) = 0

b is a full-support complexity:

O(ed 2)

w

v

v

v

w

w

C =T=4

22

2

1

1

1

0

0

0

0

x

y

z

x<y<z

0

1

1

12

Page 54: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-56

0

1

Full AC (FAC*)

NC*

For all Cij a b

Cij(a,b) + Cj(b) = 0

(full support)

w

v

v

w

C =0 T=4

01

0

1

0

x

z1

1

That’s our starting point!No termination !!!

Page 55: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-57

0

0

1

1

Full DAC (FDAC*)

NC*

For all Cij (i<j) a b

Cij(a,b) + Cj(b) = 0(full support)

For all Cij (i>j) a b, Cij(a,b) = 0(support)

Complexity: O(end3)

w

v

v

v

w

w

C =T=4

22

2

11

1

0

0

0

x

y

z

x<y<z

21

12

Page 56: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-58

Hierarchy

NC* O(nd)

AC* O(n 2d 3) DAC* O(ed 2)

FDAC* O(end 3)AC

NC

DAC

Special case: CSP (Top=1)

Page 57: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-59

Boosting search with LC

BT(X,D,C)if (X=) then Top :=c

else xj := selectVar(X)

forall aDj do

cC s.t. xj var(c) c:=Assgn(c, xj ,a)

c:= cC s.t. var(c)= c

if (LC) then BT(X-{xj},D-{Dj},C)

Page 58: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-60

BT

MNC

MAC/MDAC

MFDAC

Page 59: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-61

Boosting Systematic Search with Local search

Ex: Frequency assignment problem Instance: CELAR6-sub4

#var: 22 , #val: 44 , Optimum: 3230

Solver: toolbar MNC* 1 year (estimated) MFDAC* 1 hour

Page 60: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-63

Introduction and definitions Why soft constraints and dedicated algorithms? Generic and specific models

Solving soft constraint problems By search (systematic and local) By complete inference… and search By incomplete inference… and search

Existing implementations

Page 61: Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona

August 24, 2004 ECAI 2004 Tutorial: Constraint processing

B-64

Known implementations

Con'Flex: fuzzy CSP system with integer, symbolic and numerical constraints (www.inra.fr/bia/T/conflex).

clp(FD,S): semi-ring CLP (pauillac.inria.fr/.georget/clp_fds/clp_fds.html).

LVCSP: Common-Lisp library for Valued CSP with an emphasis on strictly monotonic operators (ftp.cert.fr/pub/lemaitre/LVCSP).

Choco: a claire library for CSP. Existing layers above Choco implements some WCSP algorithms (www.choco-constraints.net).

toolbar: C library for MaxCSP and related problems (carlit.toulouse.inra.fr/cgi-bin/awki.cgi/ToolBarIntro).

carlit.toulouse.inra.fr/cgi-bin/awki.cgi/SoftCSP