34
William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch and Bound with Soft Arc Consistency

William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Embed Size (px)

Citation preview

Page 1: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

William Lam

March 20, 2013

(with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models)

Discrete Optimization via Branch and Bound with Soft Arc

Consistency

Page 2: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Introduction Bayes nets/Markov random fields/factor graphs

Most Probable Explanation (MPE), Maximum a Posteriori (MAP): maximizing probability

Weighted CSP/Cost function network Minimum cost

Problems are reducible to each other

2

Page 3: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

3

X1

X3

X5X4

X2

• Select a variable

Search Basic Step: Conditioning

Page 4: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

4

X1

X3

X5X4

X2

X3

X5X4

X2

X3

X5X4

X2

X3

X5X4

X2

…...

…...

X1 aX1 b

X1 c

Search Basic Step: Conditioning

Page 5: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Depth-First Branch and Bound (DFBB)

(LB) Lower Bound

(UB) Upper Bound

If UB then prune

Var

iabl

es

under estimation of the best solution in the sub-tree

= best solution so far

Each node is a subproblem(defined by current conditioning)

LBf

= f

= k

k

5

Page 6: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Computing Bounds Static Mini-Bucket heuristics

(Kask & Dechter, AIJ’01), (Marinescu & Dechter, IJCAI’05) (with max-marginal matching)

(Ihler et al. UAI’12)

Dynamic Mini-Bucket heuristics(Marinescu & Dechter, IJCAI’05)

Maintaining local consistency (Larrosa & Schiex, AAAI’03), (de Givry et al., IJCAI’05)

Page 7: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Local Consistency in Constraint Networks

q Massive local inference § Time efficient (local inference, as mini buckets)§ Infer only small constraints, added to the network§ No variable is eliminated § Produces an equivalent more explicit problem§ May detect inconsistency (prune tree search)

Arc consistency inference in the scope of 1 constraint

7

Page 8: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Arc Consistency (binary CSP)q for a constraint cAB and variable A

w

v v

w

0

0

0

0

A B

A B cAB

v v 0

v w 0

w v w w

A cA

v 0

w

cAB + cB

Elim B(min)

Applied iteratively on all constraint/variables Empty domain => inconsistency

8

Page 9: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

1

Arc Consistency and Cost Functionsq for a cost function fAB and a variable A

w

v v

w

0

0

1

0

A B

2

1

A B fA

B

v v 0

v w 0

w v 2

w w 1

A gA

v 0

w 1

fAB + fB

Elim B(min)

EQUIVALENCE LOST

9

Page 10: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

1

1

2

Subtract from source in order to preserve the problem Equivalence Preserving Transformation

Shifting Costs (cost compensation)

w

v v

w

0

0

1

A B1

0

A B fAB

v v 0

v w 0

w v

w w

A gA

v 0

w 11

0

2

1

Elim B

10

Page 11: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Complete Inference vs Local Inferenceq Local consistency

§ Combine, eliminate, add & subtract

§ Massive local inference§ Space/time efficient§ Preserves equivalence

§ Provides a lb f

11

Complete inference

Combine, eliminate, add & forget

Systematic inference Exponential time/space Preserves optimum

Provides the optimum f

Page 12: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

q Shifting costs from fAB to AShift(fAB,(A,w),1)

q Can be reversed (e.g. Shift(fAB,(A,w), -1))

0

1

Equivalence Preserving Transformation

w

v v

w

0

0

1

A B1

Arc EPT: shift cost in the scope of 1 cost functionProblem structure preserved

12

Page 13: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Equivalence Preserving Transformations

1f =

• EPTs may cycle• EPTs may lead to different f0

• Which EPTs should we apply?

Shift(fAB,(A,b),1)

Shift(fA,(),1) Shift(fAB,(B,a),-1)

Shift(fAB,(B,a),1)

A B A B A B

13

Page 14: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Node Consistency (NC*)

§ For any variable A• a, f + fA(a)<k

• a, fA (a)= 0

§ Complexity:O(nd)

w

v

v

v

w

w

f =k =

32

2

11

1

1

1

0

0

1

A

B

C

0

0

014

Shift(fC, ,1) Shift(fA, ,-1);Shift(fA, ,1)

(Larrosa, AAAI 2002)

14

Page 15: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

0

0

Arc Consistency (AC*)

§ NC*

§ For all fAB • a b

fAB(a,b)= 0

§ b is a simple-support§ complexity:

O(n 2d 3)

wv

v

w

w

f =k=4

2

11

1

0

0

0

0

1

A

B

C

1

12

Shift(fAC,(C,v),2) Shift(fBC,(B,v),1)

Shift(fBC,(B,w),1)

Shift(fB,,1) Shift(fC,,-2) Shift(fC,,2)

(Larrosa, AAAI 2002)

(Schiex, CP 2000)

15

Page 16: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Full Arc Consistency (FAC*) NC*

For all fAB

• a b fAB(a,b) + fB(b) = 0

b is a full-support Too strong to enforce

Page 17: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

1

1

Directional AC (DAC*)

§ NC*

§ For all fAB (A<B)• a b

fAB(a,b) + fB(b) = 0

§ complexity:O(ed 2)

w

v

v

v

w

w

f =k=4

22

2

1

1

1

0

0

0

0

A

B

C

A<B<C

0

1

1

12

(Cooper, Fuzzy Sets and Systems 2003)

Shift(fBC,(C,v),-1) Shift(fBC,(B,v),1) Shift(fBC,(B,w),1) Shift(fB, ,1)

Shift(fA,, -2) Shift(fA,, 2)17

Page 18: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Other Local Consistencies

q FDAC* = DAC+AC+NC§ Stronger lower bound§ O(end3)§ Better compromise

q EDAC* = FDAC+ EAC (existential AC)§ Even stronger§ O(ed 2 max{nd, k})§ Currently among the best practical choice

(Larrosa & Schiex, IJCAI 2003)(Cooper, Fuzzy Sets and Systems 2003)

(Larrosa & Schiex, AI 2004)

(Cooper & Schiex, AI 2004)

(de Givry et al., IJCAI 2005)

(Sanchez et al, Constraints 2008)

19

Page 19: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

20

0

0

FDAC* DAC* + AC*

For all fAB (A<B)• a b

fAB(a,b) + fB(b) = 0

For all fAB (A>B)• a b

fAB(a,b)= 0 w

vw

w

f =k=4

2

0

0

A

B

C

A<B<C2

v

Page 20: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Existential Arc Consistency (EAC*)Getting closer to FAC*

For all fAB

• a bfA(a) = 0

fAB(a,b) + fB(b) = 0

(A full support in both directions)

If a variable A is not EAC, we can enforce full-supports and break NC Leads to increasing lower bound

Page 21: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

EDAC* FDAC* + EAC* Every value is fully supported in one direction

and simply supported in the other (FDAC*) At least one value per variable is fully

supported in both directions (EAC*) FDAC* < EDAC* < FAC*

Page 22: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

FDAC*

Page 23: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch
Page 24: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

EDAC*

Page 25: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

EDAC*

EAC*

DAC*

AC*

NC*

Page 26: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Other (Stronger) Consistency Properties Optimal Soft Arc Consistency

Finds an optimal set of rational EPTs

(Cooper et al., IJCAI’07) (Schlesinger, Kibernetika 1976)

Virtual Arc Consistency Finds an improving sequence of rational EPTs

(Cooper et al., AAAI’08)

Page 27: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Higher Arity Functions Consistency enforcing ignores functions with arity > 2

Must wait until sufficient conditioning reduces function arity to 2

Enhancement: preprocess problem before search Perform EPTs on functions with arity > 2 to generate binary functions

A B C f

0 0 0 6

0 0 1 3

0 1 0 9

0 1 1 5

1 0 0 4

1 0 1 2

1 1 0 7

1 1 1 10

A B f0 0 30 1 51 0 21 1 7

A C f0 0 30 1 01 0 01 1 0

3

0

4

0

2

0

0

3

0

0

1

0

2

0

0

3

Page 28: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Variable/Value Selection Weighted Degree

For each constraint, count the number of times an inconsistency is reached during search

Variable xi weight is the sum of the weights of all constraints involving xi and another uninstantiated variable

(Boussemart et al., ECAI’04)

Last conflicts Maintain a set of variables that resulted in a dead end and prioritize testing

these first

(Lecoutre et al., AI’09)

Values: use unary functions as lower bounds

Page 29: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

Overall Algorithm Input: a cost function network N (preprocessed to enforce consistency) Output: solution cost Initialize: UB = ksolve(N):

if all domains are empty, return N0

X = VariableSelectionHeuristic(N)

a = argmin N(X)

N’ = EnforceConsistency(N|X=a)

if N’0 >= UB,

N’ = EnforceConsistency(N|X!=a) // remove a from N.D(X)

return UB = min(UB, solve(N’))

Page 30: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

UAI’08 Competition Results

31

Page 31: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

UAI’08 Competition Results (II)

32

Page 32: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

UAI’08 Competition Results (III)

33

Page 33: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

SoftwareToulbar2

http://mulcyber.toulouse.inra.fr/gf/project/toulbar2(Open source WCSP, MPE solver in C++)

Participated in CP06, CP08, UAI08, UAI10, and PIC11 competitions

34

Page 34: William Lam March 20, 2013 (with slides from the IJCAI-09 tutorial on Combinatorial Optimization for Graphical Models) Discrete Optimization via Branch

DAOOPT and Toulbar2 DAOOPT (our AOBB-based solver)

Bounds computed before search via MBE• “Top-down approach”: Variable duplication to reduce cluster size• Re-parameterization to enforce consistency between copies of variables

(FGLP+JGLP+MBE-MM) (Ihler et al., UAI’12)• Fast node expansion

Static variable ordering Toulbar2

Bounds incrementally improved during search via SAC• “Bottom-up approach”: Ignores larger factors until conditioning reduces their

size• Re-parameterization directly generates bounds• Node expansion speed depends on consistency algorithm

Dynamic variable ordering

35