Download presentation
Presentation is loading. Please wait.
1
Soft constraint processing Thomas Schiex INRA – Toulouse France Pedro Meseguer CSIC – IIIA – Barcelona Spain Special thanks to: Javier Larrosa UPC – Barcelona Spain
2
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
3
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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 (B i, V i ), B i requested goods, V i value … find the best subset of compatible bids Best = maximize revenue (sum)
4
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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)
5
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-5 Why soft constraints Multiple sequence alignment (DNA,AA) Given k homologous sequences… AATAATGTTATTGGTGGATCGATGA ATGTTGTTCGCGAAGGATCGATAA … find the best alignment (sum) AATAATGTTATTGGTG---GATCGATGATTA ----ATGTTGTTCGCGAAGGATCGATAA---
6
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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)
7
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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)
8
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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.
9
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
10
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-10 Soft constraints Two new difficulties: How to express preferences in the model? How to solve the resulting optimization problem?
11
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-11 Solving soft constraints as a CSP Using a global criteria constraint New constraint S k on all X S k (X) = criteria value must be more than k Number of variables having value blue Apply: k := n Repeat solve the original problem S k (X) k:=k-1; Until solution n-ary constraint Inefficient!!
12
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
13
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-13 Soft constraint network (X,D,C)(X,D,C) X={x 1,..., x n } variables D={D 1,..., D n } finite domains C={c 1,..., c e } cost functions var(c i ) scope c i (t): E (ordered cost domain, T, ) Obj. Function: F(X)= c i (X) Solution: F(t) T Soft CN: find minimal cost solution identity annihilator commutative associative monotonic
14
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-14 Semiring CSP Valued CSP and Semiring CSP Valued CSP (total order)
15
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-15 Specific frameworks E = {t,f} = andclassical CSP E = [0,1] = max fuzzy CSP E = N = +weighted CSP E = [0,1] = *bayesian net Lexicographic CSP, probabilistic CSP…
16
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-16 Weighted CSP example ( = +) x3x3 x2x2 x5x5 x1x1 x4x4 F(X): number of non blue vertices For each vertex For each edge: xixi c(x i ) b0 g1 r1 xixi xjxj c(x i,x j ) bbT bg0 br0 gb0 ggT gr0 rb0 rg0 rrT
17
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-17 Fuzzy constraint network ( =max) x3x3 x2x2 x5x5 x1x1 x4x4 F(X): highest color used (b<g<r<y) For each vertex Connected vertices must have different colors xixi c(x i ) b0.2 g0.4 r0.6 y0.8
18
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
19
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-19 Weighted CSP example ( = +) x3x3 x2x2 x5x5 x1x1 x4x4 F(X): number of non blue vertices For each vertex For each edge: xixi c(x i ) b0 g1 r1 xixi xjxj c(x i,x j ) bbT bg0 br0 gb0 ggT gr0 rb0 rg0 rrT T=6 c = 0 T=3 Optimal coloration with less than 3 non-blue
20
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-20 Microstructural graph 0 1 1 b g r x5x5 x4x4 x2x2 x1x1 x3x3 T=6 c =0 0 1 1 6 6 6
21
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-21 WCSP: Example w v v v w w C = 0 T=4 2 2 2 1 1 1 1 1 0 0 0 x y z X={x y z} D i ={v w} C={C xz C yz C x C y C z C } Valuation: 2 1 2 1 0 0 = T Not a solution Valuation: 0 1 0 1 0 0 = 2 (optimal) solution
22
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-22 Basic operations on cost functions I.Assignment (conditioning) II.Combination (join) III.Projection (elimination)
23
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-23 Assignment (conditioning) xixi xjxj c(x i,x j ) bbT=6 bg0 br0 gb0 gg gr0 rb0 rg0 rr Assign(c,x i,b) xjxj bT=6 g0 r0 f(x j ) Assign(f,x j,g) 0 hh
24
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-24 Combination (join with ) xixi xjxj c(x i,x j ) bb6 bg0 gb0 gg6 xjxj xkxk c(x j,x k ) bb6 bg0 gb0 gg6 xixi xjxj xkxk f(x i,x j,x k ) bbb12 bbg6 bgb0 bgg6 gbb6 gbg0 ggb6 ggg = 0 6
25
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-25 Projection (elimination) xixi xjxj c(x i,x j ) bb4 bg6 br0 gb2 gg6 gr3 rb1 rg0 rr6 Elim(c,x j ) xixi f(x i ) b g r 0 0 2 Elim(f,x i ) hh 0 Min
26
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
27
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-27 Systematic search (LB) Lower Bound (UB) Upper Bound If UB then prune variables under estimation of the best solution in the sub-tree = best solution so far Each node is a soft constraint subproblem cc LB = c = T
28
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-28 Assigning x 3 x3x3 x2x2 x5x5 x1x1 x4x4 x2x2 x5x5 x1x1 x4x4 x2x2 x5x5 x1x1 x4x4 x2x2 x5x5 x1x1 x4x4
29
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-29 T Assign g to X 0 x5x5 x4x4 x2x2 x1x1 x3x3 T=6 c=c= 0 6 6 6 b g r 1 1 01 110 11 0 11 0 11 T T b g r 34 T Backtrack
30
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-30 Depth First Search (DFS) BT(X,D,C) if (X= ) then Top :=c else x j := selectVar(X) forall a D j do c C s.t. xj var(c) c:=Assign(c, x j,a) c := c C s.t. var(c)= c if (LB<Top) then BT(X-{x j },D-{D j },C) Heuristics Improve LB Good UB ASAP
31
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-31 Improving the LB Assigned constraints (c ) Original constraints Solve Optimal cost c Gives a stronger LB Can be solved beforehand
32
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-32 Russian Doll Search static variable ordering solves increasingly large subproblems uses previous LB recursively May speedup search by several orders of magnitude X1X1 X2X2 X3X3 X4X4 X5X5
33
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
34
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-34 Boosting Systematic Search with Local Search Local search (X,D,C) time limit Sub-optimal solution 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
35
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
36
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
37
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
38
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-38 CC Variable elimination Select a variable X i Compute the set K i of constraints that involves this variable Add Elim( ) Remove variable and K i Time: (exp(deg i +1)) Space: (exp(deg i )) X 4 X 3 X5X5 X 2 X 1
39
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-39 X 5 Graph induced by an elimination order The original graph plus all the extra edges for computed constraints Induced width = max number of variables involved in a K i = max number of neighbors after. X 4 X 3 X 2 X 1 2 22 1 0 Induced width = 2
40
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-40 Variable elimination Time: exponential in the size of the largest combination performed (1+induced width) Space: similar ! Infeasible as a general method…
41
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-41 Boosting search with variable elimination: BB-VE(k) At each node Select an unassigned variable X i If deg i ≤ k then eliminate X i Else branch on the values of X i Properties BE-VE(-1) is BB BE-VE(w*) is VE BE-VE(1) is like cycle-cutset
42
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-42 Example BB-VE(2)
43
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-43 Example BB-VE(2) cc cc cc
44
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
45
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
46
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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…
47
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-47 Classical arc consistency (binary CSP) for any X i and c ij f=Elim(c ij c i c j,X j ) brings no new information on X i w v v w 0 0 0 0 ij T T XiXi XjXj c ij vv0 vw0 wvT wwT XiXi f(X i ) v0 wT c ij c i c j Elim x j T
48
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-48 Arc consistency and soft constraints for any X i and c ij f=Elim(c ij c i c j,X j ) brings no new information on X i w v v w 0 0 0 0 ij 2 1 XiXi XjXj c ij vv0 vw0 wv2 ww1 XiXi f(X i ) v0 w1 c ij c i c j Elim x j 1 EQUIVALENCE LOST … unless idempotent (fuzzy CSP)
49
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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 xixi xjxj c(x i,x j ) bb0.6 bg0.3 gb0.1 gg0.5 Cut(c, 0.4) xixi xjxj c(x i,x j ) bbT bg0 gb0 ggT
50
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
51
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-51 Back to Weighted CSP and Arc consistency for any X i and c ij f=Elim(c ij c i c j,X j ) brings no new information on X i w v v w 0 0 0 0 ij 2 1 XiXi XjXj c ij vv0 vw0 wv2 ww1 XiXi f(X i ) v0 w1 c ij c i c j Elim x j 1 EQUIVALENCE LOST … unless idempotent (fuzzy CSP)
52
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-52 Projection of c ij on X i 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 ij 1 0
53
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-53 Node Consistency (NC * ) For all variable i a, C + C i (a)<T a, C i (a)= 0 Complexity: O(nd) w v v v w w C =C = T = 3 2 2 1 1 1 1 1 0 0 1 x y z 0 0 0 1 4
54
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-54 0 Arc Consistency (AC * ) NC * For all C ij a b C ij (a,b)= 0 b is a support complexity: O(n 2 d 3 ) w v v w w C =C = T=4 2 1 1 1 0 0 0 0 1 x y z 1 1 2 0
55
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-55 1 1 Directional AC (DAC * ) NC * For all C ij (i<j) a b C ij (a,b) + C j (b) = 0 b is a full-support complexity: O(ed 2 ) w v v v w w C =C = T=4 2 2 2 1 1 1 0 0 0 0 x y z x<y<zx<y<z 0 1 1 12
56
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-56 0 1 Full AC (FAC * ) NC * For all C ij a b C ij (a,b) + C j (b) = 0 (full support) w v v w C =0 T=4 0 1 0 1 0 x z 1 1 That’s our starting point! No termination !!!
57
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-57 0 0 1 1 Full DAC (FDAC * ) NC * For all C ij (i<j) a b C ij (a,b) + C j (b) = 0 (full support) For all C ij (i>j) a b, C ij (a,b) = 0 (support) Complexity: O(end 3 ) w v v v w w C =C = T=4 2 2 2 1 1 1 0 0 0 x y z x<y<zx<y<z 2 1 1 2
58
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-58 Hierarchy NC * O(nd) AC * O(n 2 d 3 )DAC * O(ed 2 ) FDAC * O(end 3 ) AC NC DAC Special case: CSP (Top=1)
59
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-59 Boosting search with LC BT(X,D,C) if (X= ) then Top :=c else x j := selectVar(X) forall a D j do c C s.t. xj var(c) c:=Assgn(c, x j,a) c := c C s.t. var(c)= c if (LC) then BT(X-{x j },D-{D j },C)
60
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-60 BT MNC MAC/MDAC MFDAC
61
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
62
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-62 CPU time n. of variables
63
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
64
August 24, 2004ECAI 2004 Tutorial: Constraint processingB-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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.