510 likes | 670 Views
Constraint Optimization. Presentation by Nathan Stender Chapter 13 of Constraint Processing by Rina Dechter. Motivation. Real-life problems often have both hard and soft constraints Hard constraints must be satisfied Soft constraints would like to be satisfied Goal is to
E N D
Constraint Optimization Presentation by Nathan Stender Chapter 13 of Constraint Processing by RinaDechter Constraint Optimization
Motivation • Real-life problems often have both hard and soft constraints • Hard constraints must be satisfied • Soft constraints would like to be satisfied • Goal is to • optimize soft constraints • while satisfying hard constraints • Applications • Planning • Scheduling • Design Constraint Optimization
Example: Combinatorial Auction • Bidders place a bid on a set of items • Hard constraints: no two bids sharing an item can be selected • Soft constraints: cost of selecting each bid • Auctioneer must select bids to maximize revenue Constraint Optimization
Outline • Motivation • Constraint Optimization and Cost Networks Section 13.1 • Branch-and-Bound Search Section 13.2 • Bucket Elimination for OptimizationSection 13.3 • Mini-bucket Elimination Section 13.4 • Search with Mini-bucket Heuristics Section 13.5 • Summary Constraint Optimization
Constraint Optimization Problem • COP = Constraint network + a cost function • Global cost function • Real-valued functional components: F1,…,Fl • F1,…,Fl defined over scopes: Q1,…,Ql, Qj∈X • Assignment: ā = (a1,…, an), aiin the domain of xi Constraint Optimization
Example: Combinatorial Auction • Boolean variables bi for bids • Each bid has an associated cost ri • bi= 1 if bid is selected, bi=v0 if bid is rejected • Hard constraint Rij between bi and bj • If they share an item: (bi=1,bi=1)∉Rij • Soft constraint F(bi) • F(bi)=ri if bi =1, F(bi)=0 if bi=0 • Goal is to maximize: Constraint Optimization
Example: Combinatorial Auction Consider the following set of bids: b1 = {1,2,3,4} Db1 = {0,1} r1 = 8 b2 = {2,3,6} Db2 = {0,1} r2 = 6 b3 = {1,4,5} Db3 = {0,1} r3 = 5 b4 = {2,8} Db4 = {0,1} r4 = 2 b5 = {5,6} Db5 = {0,1} r5 = 2 b1 b2 b3 b5 b4 R12, R13, R14, R24, R25, R35 • Optimal solution:b1 = 0, b2 = 1, b3 = 1, b4 = 0, b5 = 0 Constraint Optimization
Cost Network • 4-tuple: • (X,D,Ch) is a constraint network • Cs= {FQ1,…,FQl} is a set of cost components • Ch and Cs also called hard and soft constraints • Graph representation • Variables are nodes • Arcs connect variables in the same hard or soft constraint Constraint Optimization
Solving COP as a Series of CSPs • It is always possible to a solve COP as a series of CSPs • Add a single hard constraint: • Increase the cost-bound: • Eventually the cost-bound so high no solution exists, the previous solution is optimal Constraint Optimization
Solving COP as a Series of CSPs • With cost Cj = 1, we have 4 solutions • C2 = 11, 1 solution • C1 = 12, 0 solutions • Backtrack to previous solution, which is optimal • The cost of solving so many CSPs is prohibitive • Instead, we use search & inference Constraint Optimization
Outline • Motivation • Constraint Optimization and Cost Networks Section 13.1 • Branch-and-Bound Search Section 13.2 • Bucket Elimination for OptimizationSection 13.3 • Mini-bucket Elimination Section 13.4 • Search with Mini-bucket Heuristics Section 13.5 • Summary Constraint Optimization
Branch-and-Bound Search • Extends backtracking search • Traverses hard constraint search tree with DFS • Keeps track of two bounds using cost function • Bounds • Lower bound : cost of best solution so far • Upper bound using bounding evaluation function • For partial assignment, : • If , backtrack Constraint Optimization
Example: Combinatorial Auction 1 0 9 8 15 10 10 17 23 15 11 13 15 10 12 23 15 b1 b2 b3 b4 b5 11 10 0 1 0 r1 = 8 r2 = 6 r3 = 5 r4 = 2 r5 = 2 15 17 9 0 1 0 15 12 10 0 0 10 13 1 0 0 R12, R13, R14, R24, R25, R35 11 10 8 Constraint Optimization
Russian Doll Search • Run n successive BnB searches • Each search involves a single additional variable • First subproblem includes just nth variable • The (n-i+1)thsubproblem involves xi,…,xn • Bounds are augmented by previous searches • Previous solutions can also heuristically guide search • Extra pruning power is often worth extra cost of doing n searches Constraint Optimization
Example: Combinatorial Auction Initial lower bound given by previous optimal solution Previous searches: Russian Doll: Cost: Over b2,b3,b4,b5: 11 b2=1,b3=1,b4=0,b5=0 1 0 Over b3,b4,b5: 8+11=19 11 0 7 b3=1,b4=0,b5=1 1 0 Over b4,b5: 11 8+7=15 7 4 b4=1,b5=1 0 1 0 Over b5: 11 8+4=12 10 2 b5=1 0 0 Optimal solutions from previous searches estimate upper bound 11 8+2=10 0 r1 = 8, r2 = 6, r3 = 5, r4 = 2, r5 = 2 11 Constraint Optimization
Example: Combinatorial Auction Original: Russian Doll: 1 1 0 0 19 11 23 15 b1 b2 b3 b4 b5 10 0 0 1 1 0 0 11 15 15 17 7 9 0 0 1 1 0 0 11 12 15 12 10 10 0 0 0 0 11 10 13 10 0 1 0 0 11 11 10 8 Constraint Optimization
Improving Branch-and-Bound • Substantial work on BnB has been done for integer programs by OR community • Primary way to improve BnB is to improve accuracy of bounding function • Constraint community extends same ideas to general constraints and cost functions • Generate bounding functions using Bucket Elimination Constraint Optimization
Outline • Motivation • Constraint Optimization and Cost Networks Section 13.1 • Branch-and-Bound SearchSection 13.2 • Bucket Elimination for OptimizationSection 13.3 • Mini-bucket Elimination Section 13.4 • Search with Mini-bucket Heuristics Section 13.5 • Summary Constraint Optimization
Example: All soft constraints Consider the following cost network: g d a c f b f b d c g a and ordering: a,c,b,f,d,g Constraint Optimization
Example: All soft constraints a c b f d g Constraint Optimization
Derivation of Bucket Elimination Cost function: Move each function into lowest (leftmost) bucket: Maximize functions in highest bucket for bucket variable and move to new lowest bucket: Repeat: Constraint Optimization
Bucket Elimination for Optimization • Inference algorithm for COP • Analogous to normal bucket-elimination • Each bucket holds a set of cost functions • Join operation replaced with summation • Projection replaced with maximization (or min) • Forward direction generates an augmented cost network representation • Backward direction generates optimal solution in linear time Constraint Optimization
Joining Soft Constraints Joining is replaced by summation: 5 Constraint Optimization
Projecting Soft Constraints Projection is replaced by maximization: 6 Constraint Optimization
Bucket Elimination for Opt: Properties • Can incorporate hard constraints by adding back join and project operations • It is always possible to treat hard constraints as cost functions, but not optimal • Hard constraints have stronger properties that can only be exploited if expressed explicitly • Hard constraints permit use of local consistency enforcing • Complexity is based on induced width • For r hard and soft constraints and ordering d with induced width w*(d) • Time and space: O(r•expw*(d)+1) Constraint Optimization
Example: Combinatorial Auction b1 b2 b3 Opt b5 b4 Constraint Optimization
Example: Combinatorial Auction R21, R42, r(b4) h4(b1 ,b2) b1 b2 b3 b5 b4 Join hard constraints Opt Sum soft constraints (cost) Maximize over bucket variable Constraint Optimization
Example: Combinatorial Auction R31, R35, r(b3) h3(b1 ,b5) b1 b2 b3 b5 b4 Join hard constraints Opt Sum soft constraints (cost) Maximize over bucket variable Constraint Optimization
Example: Combinatorial Auction R12, R25, r(b2), h4(b1 ,b2) h2(b1 ,b5) b1 b2 b3 b5 b4 Join hard constraints Opt Sum soft constraints (cost) Maximize over bucket variable Constraint Optimization
Example: Combinatorial Auction r(b5), h3(b1 ,b5), h2(b1 ,b5) h5(b1) b1 b2 b3 b5 b4 Opt Sum soft constraints (cost) Maximize over bucket variable Constraint Optimization
Example: Combinatorial Auction r(b1), h5(b1 ) Opt b1 b2 b3 b5 b4 Opt Sum soft constraints (cost) Maximize over bucket variable Constraint Optimization
Example: Combinatorial Auction Go in the reverse direction to generate a solution: b1=0 b5=0 b3=1 b4=0 b2=1 Cost of optimal solution = 0 + 0 + 6 + 5 + 0 = 11 Constraint Optimization
Outline • Motivation • Constraint Optimization and Cost Networks Section 13.1 • Branch-and-Bound SearchSection 13.2 • Bucket Elimination for OptimizationSection 13.3 • Mini-bucket Elimination Section 13.4 • Search with Mini-bucket Heuristics Section 13.5 • Summary Constraint Optimization
Example: All Soft Constraints Bucket: Mini-bucket (i=3): Upper Bound (constraints are ignored, thus, the bound is optimistic) Constraint Optimization
Mini-bucket Elimination • BE is exponential in separator size (space) • Instead use mini-bucket elimination • Bucket are partitioned to restrict arity of projected constraints to at most i (variables) • Result generates an estimation of optimal solution • Size of mini-bucketslimits complexity and accuracy of estimation • Selection of partition will also affect results, so a good heuristic is needed Constraint Optimization
Example: Combinatorial Auction b1 b2 b3 Upper Bound b5 b4 Constraint Optimization
Example: Combinatorial Auction R42, r(b4) h4(b2) b1 b2 b3 b5 b4 Bound Sum soft constraints (cost) Maximize over bucket variable Constraint Optimization
Example: Combinatorial Auction R35, r(b3) h3(b5) b1 b2 b3 b5 b4 Bound Sum soft constraints (cost) Maximize over bucket variable Constraint Optimization
Example: Combinatorial Auction h2(b5) R25, r(b2), h4(b2) b1 b2 b3 b5 b4 Bound Sum soft constraints (cost) Maximize over bucket variable Constraint Optimization
Example: Combinatorial Auction b1 h5 r(b2), h3(b5) , h2(b5) b2 b3 b5 b4 Bound Sum soft constraints (cost) Maximize over bucket variable Constraint Optimization
Example: Combinatorial Auction b1 Bound r(b1), h5 b2 b3 b5 b4 Bound Sum soft constraints (cost) Maximize over bucket variable Constraint Optimization
Example: Combinatorial Auction Go in the forward direction to generate a solution (lower bound): b1=1 b5=0 b2=0 b3=0 b4=0 b1 b2 Cost of solution/lower bound: 8 b3 Interval bound on optimal solution: [8,19] b5 b4 Constraint Optimization
Mini-bucket Elimination: Properties • Partitioning buckets amounts to moving maximization inside summation: • Going up the elimination ordering (backward direction) • Maximization over mini-buckets gives an upper bound • Going down the instantiation ordering (forward direction) • Finding a solution provides a lower bound • Complexity depends on i, assuming i < w* • If : Time and space complexity = O(exp(i)) • Otherwise: Time = O(r•exp(i)), Space = O(r•exp(i-1)), where r is the number of cost functions Constraint Optimization
Outline • Motivation • Constraint Optimization and Cost Networks Section 13.1 • Branch-and-Bound SearchSection 13.2 • Bucket Elimination for OptimizationSection 13.3 • Mini-bucket EliminationSection 13.4 • Search with Mini-bucket Heuristics Section 13.5 • Summary Constraint Optimization
Search with Mini-Bucket Heuristics • Mini-bucket allows us to bound error, however we may need the optimal solution • We can improve search with estimations from mini-buckets • Search using BnB, use mini-bucket to improve accuracy of bounding function • At each step, estimate the cost of optimal solution given a partial assignment using mini-bucket • Assuming a static variable ordering, buckets can be computed before search Constraint Optimization
Example: Combinatorial Auction fmb (b1=0,b5=0,b2=0) = 0+h4(b2) +h3(b5) = 0+2+5 = 7 fmb (b1=0,b5=0,b2=1,b3=0) = 6+0+h4(b2) = 6+0+0 = 6 fmb (b1=0) = 0+h5 = 0+11 = 11 fmb (b1=0) = 0+h5 = 0+11 = 11 fmb (b1=1,b5=0) = 8+0+h2(b5) +h3(b5) = 8+0+6+5 = 19 fmb (b1=0,b5=0) = 0+h2(b5) +h3(b5) = 0+6+5 = 11 fmb (b1=0,b5=1) = r5+h2(b5) +h3(b5) = 2+2+0 = 4 fmb (b1=1) = r1+h5 = 8+11 = 19 fmb (b1=0,b5=0,b2=1,b3=1) = 6+r3+h4(b2) = 6+5+0 = 11 fmb (b1=1,b5=1) = 8+r5+h2(b5) +h3(b5) = 8+2+0+0 = 10 fmb (b1=0,b5=0,b2=1) = r2+h4(b2) +h3(b5) = 6+0+5 = 11 b1 L= 8 11 10 Lower bound is initialized to lower bound found during mini-bucket b2 b3 1 0 11 19 b5 b4 0 1 0 1 11 10 19 4 0 1 0 0 11 10 8 7 0 0 0 1 10 11 8 6 0 0 0 Bound 8 11 10 Constraint Optimization
Mini-bucket Heuristics Properties Definition 13.1: Given an ordered set of augmented buckets generated by the mini-bucket algorithm, the bounding function is the sum of all the new functions that are generated in buckets p+1 through n and reside in buckets 1 through p. That is: • Theorem 13.5 (paraphrased): • The mini-bucket heuristic never under-estimates the cost of the optimal extension of a given partial assignment • The heuristic is monotonic, as search goes deeper the bound can only decrease, meaning it is more accurate. Constraint Optimization
Example: Combinatorial Auction In this case the bounding functions perform similarly, but mini-bucket is more accurate! First-choice Mini-bucket 1 0 11 19 1 0 0 1 0 1 15 11 23 10 19 4 0 1 0 1 0 1 0 0 13 11 23 21 15 10 8 0 1 7 0 0 0 0 0 0 13 1 17 15 10 9 7 11 8 6 0 0 0 0 0 0 0 12 13 8 10 0 8 11 0 10 11 10 Constraint Optimization
Outline • Motivation • Constraint Optimization and Cost Networks Section 13.1 • Branch-and-Bound SearchSection 13.2 • Bucket Elimination for OptimizationSection 13.3 • Mini-bucket EliminationSection 13.4 • Search with Mini-bucket HeuristicsSection 13.5 • Summary Constraint Optimization
Summary • Constraint optimization problems consist of a constraint network and a global cost function. • A COP can be solved as a CSP, but search and inference methods more efficient • Branch-and-bound search is a simple method which extends backtrack search with a bounding function • Bucket Elimination is an inference method which can generate COP solutions in a backtrack-free manner • Mini-bucket Elimination partitions buckets into subsets in order to reduce complexity, while still generating a bound for a COP • BnB can be augmented with a mini-bucket based heuristic allowing inference and search methods to be combined. Constraint Optimization