Stender Chapter 13 of Constraint Processing by Rina Dechter 3252013 1 Constraint Optimization Motivation 3252013 2 Constraint Optimization Reallife problems often have both hard ID: 657055
Download Presentation The PPT/PDF document "Constraint Optimization Presentation by ..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Constraint Optimization
Presentation by Nathan StenderChapter 13 of Constraint Processing by Rina Dechter
3/25/2013
1
Constraint OptimizationSlide2
Motivation
3/25/20132Constraint Optimization
Real-life problems often have both
hard and soft constraintsHard constraints
must
be satisfied
Soft constraints
would like
to be satisfied
Goal is to optimize soft constraints while satisfying hard constraintsApplicationsPlanningSchedulingDesignSlide3
Example: Combinatorial Auction
Bidders place a bid on a set of itemsHard constraints: no two bids sharing an item can be selectedSoft constraints: cost of selecting each bidAuctioneer must select bids to maximize revenue
3/25/2013
Constraint Optimization
3Slide4
Outline
3/25/2013Constraint Optimization4
Motivation
Constraint Optimization and Cost Networks
Section 13.1
Branch-and-Bound Search
Section 13.2
Bucket Elimination for Optimization
Section 13.3Mini-bucket Elimination Section 13.4Search with Mini-bucket Heuristics
Section 13.5SummarySlide5
Constraint Optimization Problem
COP = Constraint network + a cost functionGlobal cost functionReal-valued functional components: F1
,…,
Fl
F
1
,…,
F
l
defined over scopes: Q1
,…,Ql
,
Q
j
∈
X
Assignment:
ā
= (
a
1
,…,
an), ai in the domain of xi
3/25/2013
Constraint Optimization
5Slide6
Example: Combinatorial Auction
Boolean variables bi for bidsEach bid has an associated cost
ri
b
i
= 1
if bid is selected,
b
i =v0 if bid is rejectedHard constraint
Rij between b
i
and
b
j
If they share an item: (
b
i
=1,
b
i
=1)∉
RijSoft constraint F(bi) F
(b
i)=
ri
if b
i =1, F(
bi)=0 if bi =0
Goal is to maximize:3/25/2013
Constraint Optimization6
R
ij
b
i
b
j
cost
0
0
0
1
0
r
i
0
1
r
jSlide7
Example: Combinatorial Auction
Consider the following set of bids:
3/25/2013
Constraint Optimization
7
b
1
b
2
b
3
b
4
b
5
Optimal solution:
b
1
=
0,
b
2
=
1,
b
3
=
1,
b
4
=
0,
b
5
=
0
b
1
= {1,2,3,4}
D
b
1
= {0,1}
r
1
= 8
b
2
= {2,3,6}
D
b
2
= {0,1}
r
2
= 6
b
3
= {1,4,5}
D
b
3
= {0,1}
r
3
= 5
b
4
= {2,8}
D
b
4
= {0,1}
r
4
= 2
b
5
= {5,6}
D
b
5
= {0,1}
r
5
= 2
R
12
,
R
13
,
R
14
,
R
24
,
R
25
,
R
35Slide8
4-tuple:
(X,D,
C
h) is a constraint network
C
s
= {
F
Q1,…,
FQ
l
}
is a set of cost components
C
h
and
C
s
also called
hard
and
soft
constraints Graph representationVariables are nodesArcs connect variables in the same hard or soft constraint3/25/2013Constraint Optimization8Cost NetworkSlide9
Solving COP as a Series of CSPs
It is always possible to a solve COP as a series of CSPsAdd 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
9Slide10
Solving COP as a Series of CSPs
With cost Cj = 1, we have 4 solutionsC2 = 11, 1 solutionC1 = 12, 0 solutions
Backtrack to previous solution, which is optimalThe cost of solving so many CSPs is prohibitive
Instead, we use search & inference3/25/2013
Constraint Optimization
10Slide11
Outline
3/25/2013Constraint Optimization11
Motivation
Constraint Optimization and Cost Networks
Section 13.1
Branch-and-Bound Search
Section 13.2
Bucket Elimination for Optimization
Section 13.3Mini-bucket Elimination Section 13.4
Search with Mini-bucket Heuristics Section 13.5SummarySlide12
Branch-and-Bound Search
Extends backtracking searchTraverses hard constraint search tree with DFSKeeps track of two bounds using cost functionBoundsLower bound : cost of best solution so farUpper bound using bounding evaluation function
For partial assignment, :If , backtrack
3/25/2013
Constraint Optimization
12Slide13
Example: Combinatorial Auction
3/25/2013Constraint Optimization13
1
0
0
1
0
0
1
0
1
0
0
0
23
10
17
12
10
10
8
15
15
15
13
11
11
9
0
10
23
17
12
10
10
8
15
15
15
13
11
9
10
r
1
= 8
r
2
= 6
r
3
= 5
r
4
= 2
r
5
= 2
R
12
,
R
13
,
R
14
,
R
24
,
R
25
,
R
35
b
1
b
2
b
3
b
4
b
5 Slide14
Russian Doll Search
Run n successive BnB searchesEach search involves a single additional variableFirst subproblem includes just
nth variableThe (n-i+1
)th subproblem involves x
i
,…,
x
n
Bounds are augmented by previous searches
Previous solutions can also heuristically guide searchExtra pruning power is often worth extra cost of doing n searches3/25/2013
Constraint Optimization
14Slide15
Example: Combinatorial Auction
3/25/2013Constraint Optimization15
1
0
0
0
1
0
1
0
0
0
0
8+11=19
8+7=15
8+4=12
8+2=10
11
11
11
11
11
7
10
Russian Doll:
Previous searches
:
Over
b
2
,
b
3
,
b
4
,
b
5
:
b
2
=1,
b
3
=1,
b
4
=0,
b
5
=0
11
Cost:
Initial lower bound given by previous optimal solution
Over
b
3
,
b
4
,
b
5
:
b
3
=1,
b
4
=0,
b
5
=1
7
Over
b
4
,
b
5
:
b
4
=1,
b
5
=1
4
Over
b
5
:
b
5
=1
2
Optimal solutions from previous searches estimate upper bound
r
1
= 8,
r
2
= 6
,
r
3
= 5
,
r
4
= 2
, r
5
= 2Slide16
Example: Combinatorial Auction
3/25/2013Constraint Optimization16
1
0
0
0
1
0
1
0
0
0
0
19
15
12
10
11
11
11
11
11
7
10
Russian Doll:
10
1
0
0
1
0
0
1
0
1
0
0
0
0
23
17
12
10
10
8
15
15
15
13
11
9
10
Original:
b
1
b
2
b
3
b
4
b
5 Slide17
Improving Branch-and-Bound
Substantial work on BnB has been done for integer programs by OR communityPrimary way to improve BnB is to improve accuracy of bounding function
Constraint community extends same ideas to general constraints and cost functionsGenerate bounding functions using Bucket Elimination
3/25/2013
Constraint Optimization
17Slide18
Outline
3/25/2013Constraint Optimization18
Motivation
Constraint Optimization and Cost Networks
Section 13.1
Branch-and-Bound Search
Section 13.2
Bucket Elimination for Optimization Section 13.3Mini-bucket Elimination Section 13.4
Search with Mini-bucket Heuristics Section 13.5SummarySlide19
Example: All soft constraints
Consider the following cost network:3/25/2013Constraint Optimization
19
a
b
c
f
g
d
and ordering
: a,
c
,
b
,
f
,
d
,
g
g
d
f
b
c
aSlide20
Example: All soft constraints
3/25/2013Constraint Optimization20
a
c
b
f
d
gSlide21
Derivation of Bucket Elimination
3/25/2013Constraint Optimization21
Cost function:
Move each function into lowest (leftmost) bucket:
Maximize functions in highest bucket for bucket variable and move to new lowest bucket:
Repeat: Slide22
Bucket Elimination for Optimization
Inference algorithm for COPAnalogous to normal bucket-eliminationEach bucket holds a set of cost functionsJoin operation replaced with summationProjection 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
22Slide23
Joining Soft Constraints
Joining is replaced by summation:3/25/2013Constraint Optimization
23
x
1
x
2
Cost
0
0
4
0
1
5
1
0
3
1
1
1
x
2
x
3Cost
00
3
01
2101
110
x1x
2x3
Cost000
7001
601060
11
…5Slide24
Projecting Soft Constraints
Projection is replaced by maximization:3/25/2013Constraint Optimization
24
x
1
x
2
x
3
Cost
0
0
0
7
0
0
1
6
0
1
0
6
0
115…
x
1
x3
Cost
007
01…
6Slide25
Bucket Elimination for Opt: Properties
Can incorporate hard constraints by adding back join and project operationsIt 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 explicitlyHard constraints permit use of local consistency enforcing
Complexity is based on induced widthFor 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 Optimization25Slide26
Example: Combinatorial Auction
3/25/2013Constraint Optimization26
b
1
b
2
b
3
b
4
b
5
OptSlide27
R
41
b
1
b
4
0
0
0
1
10
r
(
b
4
)
b
4
C
0
0
1
2
R
42
b
2
b
4
0
0
0110
R
124
b1
b2
b400
000101
010
0110
h4
(b1
,b2
)
b1
b
2
C
0
0
2
0
1
0
1
0
0
1
1
0
h
4
(
b
1
,
b
2
,
b
4
)
b
1
b
2
b
4
C
0
0
0
0
0
0
1
2
0
1
0
0
1
0
0
0
1
1
0
0
Example: Combinatorial Auction
3/25/2013
Constraint Optimization
27
R
21
,
R
42
,
r
(
b
4
)
h4(b1 ,b2)Join hard constraintsSum soft constraints (cost)
Maximize over bucket variable
Opt
b
1
b
2
b
3
b
4
b
5Slide28
h
3(b
1
,b
3
,
b
5
)
b
1
b
3
b
5
C
0
0
0
0
0
0
1
0
0
1
0
51
000
1010
h
3
(
b
1,b
5)
b1
b5C
00
501010
01
10
R
135
b1
b
3
b
5
0
0
0
0
0
1
0
1
0
1
0
0
1
0
1
r
(
b
3
)
b
3
C
0
0
1
5
R
31
b
1
b
3
0
0
0
1
1
0
R
35
b
3
b
5
0
0
0
1
1
0
Example: Combinatorial Auction
3/25/2013
Constraint Optimization
28
R
31
,
R
35
,
r
(
b
3
)h3(b1 ,b5)
Join hard constraints
Sum soft constraints (cost)
Maximize over bucket variable
Opt
b
1
b
2
b
3
b
4
b
5Slide29
R
125
b
1
b
2
b
5
0
0
0
0
0
1
0
1
0
1
0
0
1
0
1
h
2(
b
1,
b2,
b5)
b
1
b2b
5C
00020
012
01061
000
1010
h
4
(
b1,
b2)
b
1
b
2
C
0
0
2
0
1
0
1
0
0
1
1
0
h
2
(
b
1
,
b
5
)
b
1
b
5
C
0
0
6
0
1
2
1
0
0
1
1
0
r
(
b
2
)
b
2
C
0
0
1
6
R
12
b
1
b
2
0
0
0
1
1
0
R
25
b
2
b5000110Example: Combinatorial Auction3/25/2013Constraint Optimization29R12, R25, r(b2), h4(
b
1
,
b
2
)
h
2
(
b
1
,
b
5
)
Join hard constraints
Sum soft constraints (cost)
Maximize over bucket variable
Opt
b
1
b
2
b
3
b
4
b
5Slide30
h
5(b
1
)
b
1
C
0
11
1
2
h
5
(
b
1
,
b
5
)
b
1
b
5
C
0
0
11
0
1
4
10011
2
r
(
b
5
)
b
5
C
0
0
1
2h2
(
b
1
,
b
5
)
b
1
b
5
C
0
0
6
0
1
2
1
0
0
1
1
0
h
3
(
b
1
,
b
5
)
b
1
b
5
C
0
0
5
0
1
0
1
0
0
1
1
0
Example: Combinatorial Auction
3/25/2013
Constraint Optimization
30
r
(
b
5
),
h
3
(
b
1
,
b
5
),
h
2(b1 ,b5)h5(b1)Sum soft constraints (cost)Maximize over bucket variable
Opt
b
1
b
2
b
3
b
4
b
5Slide31
Opt
11
h
1
(
b
1
)
b
1
C
0
11
1
10
r
(
b
1
)
b
5
C
0
0
1
8
h
5
(
b
1
)
b
1
C
011
12Example: Combinatorial Auction3/25/2013
Constraint Optimization
31r(b
1), h
5(b
1 )
Opt
Sum soft constraints (cost)
Maximize over bucket variable
Opt
b
1
b
2
b
3
b
4
b
5Slide32
h
1(b
1
)
b
1
C
0
11
1
10
h
5
(
b
1
,
b
5
)
b
1
b
5
C
0
0
11
0
14
100
112
h2
(b1, b2
,b5
)
b1
b2b
5
C0002
001
201
061
00
01010
h
3
(
b
1
,
b
3
,
b
5
)
b
1
b
3
b
5
C
0
0
0
0
0
0
1
0
0
1
0
5
1
0
0
0
1
0
1
0
h
4
(
b
1
,
b
2
,
b
4
)
b
1
b
2
b
4
C
0
0
0
0
0
0
1
2
0
1
0
010001100Example: Combinatorial Auction3/25/2013Constraint Optimization32Go in the reverse direction to generate a solution:b1=0b5=0b2=1b3=1b4=0
Cost of optimal solution = 0 + 0 + 6 + 5 + 0 = 11Slide33
Outline
3/25/2013Constraint Optimization33
Motivation
Constraint Optimization and Cost Networks
Section 13.1
Branch-and-Bound Search
Section 13.2
Bucket Elimination for Optimization Section 13.3Mini-bucket Elimination
Section 13.4Search with Mini-bucket Heuristics Section 13.5SummarySlide34
Example: All Soft Constraints
3/25/2013Constraint Optimization34
Bucket:
Mini-bucket (
i
=3
):
Upper Bound
(constraints are ignored, thus, the bound is optimistic)Slide35
Mini-bucket Elimination
BE is exponential in separator size (space)Instead use mini-bucket eliminationBucket are partitioned to restrict arity of projected constraints to at most i (variables)Result generates an
estimation of optimal solutionSize of mini-buckets
limits complexity and accuracy of estimationSelection of partition will also affect results, so a good heuristic is needed
3/25/2013
Constraint Optimization
35Slide36
Example: Combinatorial Auction
3/25/2013Constraint Optimization36
b
1
b
2
b
3
b
4
b
5
Upper BoundSlide37
h
4(b
2
,b
4
)
b
2
b
4
C
0
0
0
0
1
2
1
0
0
h
4
(
b
2
)
b
2
C
021
0
r(b4
)
b4
C00
12
R42
b2
b40
00110
Example: Combinatorial Auction
3/25/2013
Constraint Optimization
37
R
42
,
r
(
b
4
)
h
4
(
b
2
)
Sum soft constraints (cost)
Maximize over bucket variable
Bound
b
1
b
2
b
3
b
4
b
5Slide38
h
3(b
3
,b
5
)
b
3
b
5
C
0
0
0
0
1
0
1
0
5
h
3
(
b
5
)
b
5
C
051
0
r
(
b3
)
b3
C00
15R
35
b3b
500
011
0
Example: Combinatorial Auction
3/25/2013Constraint Optimization38
R
35
,
r
(
b
3
)
h
3
(
b
5
)
Sum soft constraints (cost)
Maximize over bucket variable
Bound
b
1
b
2
b
3
b
4
b
5Slide39
h
2(b
2
,b
5
)
b
2
b
5
C
0
0
2
0
1
2
1
0
6
h
2
(
b
5
)
b
5
C
061
2
r(b2
)
b2
C00
16
R25
b2
b50
00110
h
4(b
2)
b
2C0
2
1
0
Example: Combinatorial Auction
3/25/2013
Constraint Optimization
39
R
25
,
r
(
b
2
),
h
4
(
b
2
)
h
2
(
b
5
)
Sum soft constraints (cost)
Maximize over bucket variable
Bound
b
1
b
2
b
3
b
4
b
5Slide40
h
5(b
5)
b
5
C
0
11
1
2
h
5
11
r
(
b
5
)
b
5
C
0
0
1
2
h
3
(
b
5
)
b
5
C05
10
h2(b
5)
b5
C
0610
Example: Combinatorial Auction
3/25/2013
Constraint Optimization
40
r(
b
2
),
h
3
(
b
5
) ,
h
2
(
b
5
)
h
5
Sum soft constraints (cost)
Maximize over bucket variable
Bound
b
1
b
2
b
3
b
4
b
5Slide41
Bound
19
h
1
(
b
1
)
b
1
C
0
11
1
19
r
(
b
1
)
b
1
C
0
0
1
8
h
5
11
Example: Combinatorial Auction
3/25/2013
Constraint Optimization
41
r
(
b
1), h5
Bound
Sum soft constraints (cost)
Maximize over bucket variable
Bound
b
1
b
2
b
3
b
4
b
5Slide42
h
5(b
5)
b
5
C
0
11
1
2
h
2
(
b
2
,
b
5
)
b
2
b
5
C
0
0
2
0
1
2106
h
3(b3,
b5)
b
3
b5C0
000
10105
h4
(b2,b4
)
b
2
b
4C00
0
0
1
2
1
0
0
h
1
(
b
1
)
b
1
C
0
11
1
19
Example: Combinatorial Auction
3/25/2013
Constraint Optimization
42
Go in the forward direction to generate a solution (lower bound):
b
1
=1
b
5
=0
b
2
=0
b
3
=0
b
4
=0
b
1
b
2
b
3
b
4
b
5
Cost of solution/lower bound: 8
Interval bound on optimal solution: [8,19]Slide43
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
43Slide44
Outline
3/25/2013Constraint Optimization44
Motivation
Constraint Optimization and Cost Networks
Section 13.1
Branch-and-Bound Search
Section 13.2
Bucket Elimination for Optimization Section 13.3
Mini-bucket Elimination Section 13.4Search with Mini-bucket Heuristics Section 13.5
SummarySlide45
Search with Mini-Bucket Heuristics
Mini-bucket allows us to bound error, however we may need the optimal solutionWe can improve search with estimations from mini-bucketsSearch using BnB, use mini-bucket to improve accuracy of bounding functionAt 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
45Slide46
8
f
mb
(
b
1
=0,
b
5
=0,
b2=1,
b
3
=0) = 6+0+
h
4
(
b
2
) = 6+0+0 = 6
f
mb
(
b1=0,b5
=0,
b2
=0) = 0+h
4(b
2) +h
3(b5) = 0+2+5 = 7
fmb
(b1=1,b5
=0) = 8+0+h2
(b5) +h3
(b5
) = 8+0+6+5 = 19 f
mb (b
1=0) = 0+h5 = 0+11 = 11
f
mb (b1=0) = 0+h5
= 0+11 = 11
fmb
(b1
=0,b5
=0) = 0+h2(b5
) +
h
3
(
b
5
) =
0+6+5
= 11
f
mb
(
b
1
=0,
b
5
=1) =
r
5
+
h
2
(
b
5
) +
h
3
(
b
5
) = 2+2+0 = 4
f
mb
(
b
1
=0,
b
5
=0,
b
2
=1) =
r
2
+
h
4
(
b
2
) +
h
3
(
b
5
) = 6+0+5 = 11
f
mb
(
b
1
=0,
b
5
=0,b2=1,b3=1) = 6+r3+h4(b2) = 6+5+0 = 11
fmb (b1=1) = r1+h5 = 8+11 = 19 fmb (b1=1,b5=1) = 8+r5+h2(b5) +h3(b5) = 8+2+0+0 = 10 Example: Combinatorial Auction3/25/2013Constraint Optimization46
1
1
0
0
0
0
0
0
0
0
0
0
0
0
11
1
8
10
10
10
10
8
8
19
11
11
19
4
11
6
1
11
1
h
4
(
b
2
)
b
2
C
0
2
1
0
h
3
(
b
5
)
b
5
C
0
5
1
0
h
2
(
b
5
)
b
5
C
0
6
1
0
7
b
1
b
2
b
3
b
4
b
5
h
5
11
Bound
L=
10
11
Lower bound is initialized to lower bound found during mini-bucketSlide47
Mini-bucket Heuristics Properties
3/25/2013Constraint Optimization47
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. Slide48
Example: Combinatorial Auction
3/25/2013Constraint Optimization48
In this case the bounding functions perform similarly, but mini-bucket is more accurate!
First-choice
Mini-bucket
1
1
0
0
0
0
0
0
0
0
0
0
0
7
11
0
10
12
17
23
15
21
13
15
23
15
9
0
13
8
1
13
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
7
11
1
8
10
10
10
10
8
8
19
11
11
19
4
11
6
1
11
1
10Slide49
Outline
3/25/2013Constraint Optimization49
Motivation
Constraint Optimization and Cost Networks
Section 13.1
Branch-and-Bound Search
Section 13.2
Bucket Elimination for Optimization Section 13.3
Mini-bucket Elimination Section 13.4Search with Mini-bucket Heuristics
Section 13.5
SummarySlide50
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 efficientBranch-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 mannerMini-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
50Slide51
Thank You!
Any Questions?3/25/2013Constraint Optimization
51