Constraint Optimization
Presentation by Nathan Stender
Chapter 13 of Constraint Processing by Rina Dechter
3/25/2013
Constraint Optimization
1
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
3/25/2013
Constraint Optimization
2
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
3/25/2013
Constraint Optimization
3
Outline
• Motivation
• Constraint Optimization and Cost Networks
•
•
•
•
•
Branch-and-Bound Search
Bucket Elimination for Optimization
Mini-bucket Elimination
Search with Mini-bucket Heuristics
Summary
3/25/2013
Constraint Optimization
Section 13.1
Section 13.2
Section 13.3
Section 13.4
Section 13.5
4
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), ai in the domain of xi
3/25/2013
Constraint Optimization
5
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:
3/25/2013
Constraint Optimization
Rij
bi bj cost
0
0
0
1
0
ri
0
1
rj
6
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
b4
b5
R12, R13, R14, R24, R25, R35
Optimal solution: b1 = 0, b2 = 1, b3 = 1, b4 = 0, b5 = 0
3/25/2013
Constraint Optimization
7
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
3/25/2013
Constraint Optimization
8
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
3/25/2013
Constraint Optimization
9
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
3/25/2013
Constraint Optimization
10
Outline
• Motivation
• Constraint Optimization and Cost Networks
•
•
•
•
•
Branch-and-Bound Search
Bucket Elimination for Optimization
Mini-bucket Elimination
Search with Mini-bucket Heuristics
Summary
3/25/2013
Constraint Optimization
Section 13.1
Section 13.2
Section 13.3
Section 13.4
Section 13.5
11
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
3/25/2013
Constraint Optimization
12
Example: Combinatorial Auction
1
895
13
17
1
15
11
23
10
12
10
11
b1
r1 = 8
r2 = 6
r3 = 5
r4 = 2
r5 = 2
b2
R12, R13, R14, R24, R25, R35
b5
3/25/2013
0
23
15
0
0
1
Constraint Optimization
0
9
15
10
0
12
0
b4
0
15
17
b3
1
10
13
1
0
0
10
8
11
13
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)th subproblem 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
3/25/2013
Constraint Optimization
14
Example: Combinatorial Auction
Initial lower bound given by
previous optimal solution
Previous searches:
Russian Doll:
Cost:
Over b2,b3,b4,b5:
b2=1,b3=1,b4=0,b5=0
11
1
Over b3,b4,b5:
b3=1,b4=0,b5=1
8+11=19
0
4
0
r1 = 8, r2 = 6, r3 = 5, r4 = 2, r5 = 2
Constraint Optimization
1
0
11
8+4=12
2
0
11
0
Optimal solutions from previous
searches estimate upper bound
3/25/2013
1
8+7=15
Over b5:
b5=1
11
7
Over b4,b5:
b4=1,b5=1
0
8+2=10
0
7
10
11
0
11
15
Example: Combinatorial Auction
Original:
1
b1
b2
b3
b5
3/25/2013
1
0
23
15
10
0
1
0
1
0
15
12
0
9
11
0
13
1
0
0
10
8
11
1
Constraint Optimization
0
11
15
10
10
0
19
0
15
17
0
b4
Russian Doll:
0
1
0
11
12
0
10
0
7
10
11
0
11
16
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
3/25/2013
Constraint Optimization
17
Outline
• Motivation
• Constraint Optimization and Cost Networks
•
•
•
•
•
Branch-and-Bound Search
Bucket Elimination for Optimization
Mini-bucket Elimination
Search with Mini-bucket Heuristics
Summary
3/25/2013
Constraint Optimization
Section 13.1
Section 13.2
Section 13.3
Section 13.4
Section 13.5
18
Example: All soft constraints
g
Consider the following cost network:
d
a
c
b
d
f
g
and ordering: a,c,b,f,d,g
3/25/2013
Constraint Optimization
f
b
c
a
19
Example: All soft constraints
a
c
b
f
d
g
3/25/2013
Constraint Optimization
20
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:
3/25/2013
Constraint Optimization
21
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
3/25/2013
Constraint Optimization
22
Joining Soft Constraints
Joining is replaced by summation:
x1
x2
Cost
x2
x3
Cost
0
0
4
0
0
3
0
1
5
0
1
2
1
0
3
1
0
1
1
3/25/2013
1
1
1
1
0
Constraint Optimization
x1
x2
x3
Cost
0
0
0
7
0
0
1
6
0
1
0
6
0
1
1
5
…
23
Projecting Soft Constraints
Projection is replaced by maximization:
x1
x2
x3
Cost
0
0
0
7
x1
x3
Cost
0
0
1
6
0
0
7
0
1
0
6
0
1
6
0
1
1
5
…
…
3/25/2013
Constraint Optimization
24
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)
3/25/2013
Constraint Optimization
25
Example: Combinatorial Auction
b1
b2
b3
Opt
b4
3/25/2013
Constraint Optimization
b5
26
Example: Combinatorial Auction
R21, R42, r(b4)
h4(b1 ,b2)
b1
R41
R42
R124
h4(b1,b2,b4)
h4(b1,b2)
b1 b4
b2 b4
b1 b2 b4
b1 b2 b4 C
b1 b2 C
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
1
0
1
0
0
1
0
0
1
2
0
1
0
1
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
0
1
1
0
1
1
0
1
1
0
0
r(b4)
b4
C
0
0
1
2
b2
b3
b4
b5
Join hard constraints
Sum soft constraints (cost)
Maximize over bucket variable
3/25/2013
Constraint Optimization
Opt
27
Example: Combinatorial Auction
R31, R35, r(b3)
h3(b1 ,b5)
b1
R31
R35
R135
b1 b3
b3 b5
b1 b 3 b5
b1 b3 b5
C
b1 b5
C
0
0
0
0
0
0
0
0
0
0
0
0
0
5
0
1
0
1
0
0
1
0
0
1
0
0
1
0
1
0
1
0
0
1
0
0
1
0
5
1
0
0
1
0
0
1
0
0
0
1
1
0
1
0
1
1
0
1
0
r(b3)
b3
C
0
0
1
5
h3(b1,b3,b5)
h3(b1,b5)
b2
b3
b4
b5
Join hard constraints
Sum soft constraints (cost)
Maximize over bucket variable
3/25/2013
Constraint Optimization
Opt
28
Example: Combinatorial Auction
R12, R25, r(b2), h4(b1 ,b2)
h2(b1 ,b5)
b1
R12
R25
R125
b1 b2
b2 b5
b1 b2 b5
b1 b2 b5
C
b1 b5
C
0
0
0
0
0
0
0
0
0
0
2
0
0
6
0
1
0
1
0
0
1
0
0
1
2
0
1
2
1
0
1
0
0
1
0
0
1
0
6
1
0
0
1
0
0
1
0
0
0
1
1
0
1
0
1
1
0
1
0
r(b2)
h4(b1,b2)
h2(b1, b2,b5)
h2(b1,b5)
b2
C
b1 b 2
C
0
0
0
0
2
1
6
0
1
0
1
0
0
Join hard constraints
1
1
0
Sum soft constraints (cost)
Maximize over bucket variable
3/25/2013
Constraint Optimization
b2
b3
b4
b5
Opt
29
Example: Combinatorial Auction
r(b5), h3(b1 ,b5), h2(b1 ,b5)
h5(b1)
b1
h3(b1,b5)
h2(b1,b5)
r(b5)
h5(b1,b5)
h5(b1)
b1 b 5
C
b1 b5
C
b5
C
b1 b5
C
b1
C
0
0
5
0
0
6
0
0
0
0
11
0
11
0
1
0
0
1
2
1
2
0
1
4
1
2
1
0
0
1
0
0
1
0
0
1
1
0
1
1
0
1
1
2
b2
b3
b4
b5
Sum soft constraints (cost)
Maximize over bucket variable
3/25/2013
Constraint Optimization
Opt
30
Example: Combinatorial Auction
r(b1), h5(b1 )
Opt
b1
b2
r(b1)
h5(b1)
h1(b1)
Opt
11
b5
C
b1
C
b1
C
0
0
0
11
0
11
1
8
1
2
1
10
b3
b4
b5
Sum soft constraints (cost)
Maximize over bucket variable
3/25/2013
Constraint Optimization
Opt
31
Example: Combinatorial Auction
Go in the reverse direction to generate a solution:
b1=0
b5=0
b2=1
b3=1
h1(b1)
h5(b1,b5)
h2(b1, b2,b5)
b4=0
h3(b1,b3,b5)
h4(b1,b2,b4)
b1
C
b1 b5
C
b1 b2 b5
C
b 1 b3 b5
C
b1 b2 b4
C
0
11
0
0
11
0
0
0
2
0
0
0
0
0
0
0
0
1
10
0
1
4
0
0
1
2
0
0
1
0
0
0
1
2
1
0
0
0
1
0
6
0
1
0
5
0
1
0
0
1
1
2
1
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1
0
0
Cost of optimal solution = 0 + 0 + 6 + 5 + 0 = 11
3/25/2013
Constraint Optimization
32
Outline
• Motivation
• Constraint Optimization and Cost Networks
•
•
•
•
•
Branch-and-Bound Search
Bucket Elimination for Optimization
Mini-bucket Elimination
Search with Mini-bucket Heuristics
Summary
3/25/2013
Constraint Optimization
Section 13.1
Section 13.2
Section 13.3
Section 13.4
Section 13.5
33
Example: All Soft Constraints
Bucket:
Mini-bucket (i=3):
Upper Bound
3/25/2013
Constraint Optimization
(constraints are ignored, thus, the
bound is optimistic)
34
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-buckets limits complexity and accuracy of
estimation
– Selection of partition will also affect results, so a good
heuristic is needed
3/25/2013
Constraint Optimization
35
Example: Combinatorial Auction
b1
b2
Upper Bound
3/25/2013
Constraint Optimization
b3
b4
b5
36
Example: Combinatorial Auction
R42, r(b4)
h4(b2)
b1
b2
R42
r(b4)
h4(b2,b4)
h4(b2)
b2 b4
b4 C
b2 b4 C
b2 C
0
0
0
0
0
0
0
0
2
0
1
1
2
0
1
2
1
0
1
0
1
0
0
b3
b4
b5
Sum soft constraints (cost)
Maximize over bucket variable
3/25/2013
Constraint Optimization
Bound
37
Example: Combinatorial Auction
R35, r(b3)
b1
h3(b5)
b2
R35
r(b3)
h3(b3,b5)
h3(b5)
b3 b5
b3 C
b3 b5 C
b5 C
0
0
0
0
0
0
0
0
5
0
1
1
5
0
1
0
1
0
1
0
1
0
5
b3
b4
b5
Sum soft constraints (cost)
Maximize over bucket variable
3/25/2013
Constraint Optimization
Bound
38
Example: Combinatorial Auction
R25, r(b2), h4(b2)
b1
h2(b5)
b2
R25
r(b2)
h4(b2)
h2(b2,b5)
h2(b5)
b2 b5
b2 C
b2 C
b2 b5 C
b5 C
0
0
0
0
0
2
0
0
2
0
6
0
1
1
6
1
0
0
1
2
1
2
1
0
1
0
6
b3
b4
b5
Sum soft constraints (cost)
Maximize over bucket variable
3/25/2013
Constraint Optimization
Bound
39
Example: Combinatorial Auction
b1
r(b2), h3(b5) , h2(b5)
h5
b2
r(b5)
h3(b5)
h2(b5)
h5(b5)
h5
b5 C
b5 C
b5 C
b5 C
11
0
0
0
5
0
6
0
11
1
2
1
0
1
0
1
2
b3
b4
b5
Sum soft constraints (cost)
Maximize over bucket variable
3/25/2013
Constraint Optimization
Bound
40
Example: Combinatorial Auction
b1
Bound
r(b1), h5
r(b1)
h5
h1(b1)
Bound
b1 C
11
b1 C
19
0
0
0
11
1
8
1
19
b2
b3
b4
b5
Sum soft constraints (cost)
Maximize over bucket variable
3/25/2013
Constraint Optimization
Bound
41
Example: Combinatorial Auction
Go in the forward direction to generate a solution (lower bound):
b1=1
b5=0
b2=0
b3=0
b4=0
h1(b1)
h5(b5)
h2(b2,b5)
h3(b3,b5)
h4(b2,b4)
b1 C
b5 C
b2 b5 C
b3 b5 C
b2 b4 C
0
11
0
11
0
0
2
0
0
0
0
0
0
1
19
1
2
0
1
2
0
1
0
0
1
2
1
0
6
1
0
5
1
0
0
b1
Cost of solution/lower bound: 8
b2
b3
Interval bound on optimal solution: [8,19]
b4
3/25/2013
b5
Constraint Optimization
42
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
3/25/2013
Constraint Optimization
43
Outline
• Motivation
• Constraint Optimization and Cost Networks
•
•
•
•
•
Branch-and-Bound Search
Bucket Elimination for Optimization
Mini-bucket Elimination
Search with Mini-bucket Heuristics
Summary
3/25/2013
Constraint Optimization
Section 13.1
Section 13.2
Section 13.3
Section 13.4
Section 13.5
44
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
3/25/2013
Constraint Optimization
45
Example: Combinatorial Auction
411
34(()b
5=1,
3(
2(0+
3()h
=0,
=
bh=
6+0+
= 0+2+5
6+0+0
= 7619
fmb (b1=0)
0+bh=
=
=1,
8+0+
hb25(=
b+
b=
=
=0,b=
0+0+11
)h=
hb+
= 11 =
2=0)
2 b+
52))8+0+6+5
3=0)
5=0)
5()
5 0+6+5
5)h
2(b2 )
3(b3 ) =
5r=+
419
=0,
h35=1)
=4 =
=1)b=
r1+
h
8+11
=
=0,
b=
=1,
=
+
b=
= 6+0+5
6+5+0
= 11
11
fmb (b1=1,
8+
r=
+
b345(()2+2+0
10
rh
hb+
()hb+
)h3+
=
5=1)
5b
5(
5(h
56+
2=1)
2+
2r
52))8+2+0+0
L= 11
8
10
Lower bound is initialized to lower bound found during mini-bucket
b2
1
11
0
10
0
11
10
0
8
b5 C
11
0
6
1
0
7
0
1
8
0
3/25/2013
11
0
10
0
1
8
h5
11
4
0
10
h2(b5)
0
1
19
0
b3
0
19
1
b1
0
11
6
h3(b5)
h4(b2)
b5 C
b2 C
0
5
0
2
1
0
1
0
Constraint Optimization
b4
b5
Bound
46
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.
3/25/2013
Constraint Optimization
47
Example: Combinatorial Auction
In this case the bounding functions perform similarly, but mini-bucket is more accurate!
First-choice
1
0
1
15
23
1
0
23
0
0
17
15
0
0
12
0
10
10
7
0
13
0
10
Constraint Optimization
11
0
8
7
0
1
8
0
11
11
0
10
0
1
8
0
8
11
4
0
10
0
1
19
0
13
0
0
10
0
1
9
11
1
13
15
0
19
0
1
21
0
3/25/2013
Mini-bucket
0
6
11
48
Outline
• Motivation
• Constraint Optimization and Cost Networks
•
•
•
•
•
Branch-and-Bound Search
Bucket Elimination for Optimization
Mini-bucket Elimination
Search with Mini-bucket Heuristics
Summary
3/25/2013
Constraint Optimization
Section 13.1
Section 13.2
Section 13.3
Section 13.4
Section 13.5
49
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.
3/25/2013
Constraint Optimization
50
Thank You!
• Any Questions?
3/25/2013
Constraint Optimization
51
© Copyright 2026 Paperzz