46
,

Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

  • Upload
    vuduong

  • View
    230

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & Outlook

Randomization in Backtrack Searchfor Constraint Programming

Lars Otten Mattias Grönkvist1,2 Devdatt Dubhashi1

1Department of Computer Science and Engineering,Chalmers University of Technology, Gothenburg, Sweden

2Jeppesen (Carmen Systems AB),Gothenburg, Sweden

UCI, ICS, AIML seminar � October 23rd, 2006

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 2: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & Outlook

Outline

Constraint ProgrammingBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Randomizing SearchBacktrack SearchRandomized BranchingRestarts

Results & OutlookPerformance ResultsConclusion & Outlook

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 3: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Outline

Constraint ProgrammingBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Randomizing SearchBacktrack SearchRandomized BranchingRestarts

Results & OutlookPerformance ResultsConclusion & Outlook

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 4: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Constraint satisfaction problems

De�nition

A constraint satisfaction problem (CSP) consists of:

I A �nite sequence of variables X := x1, . . . , xn, n > 0

I A domain D(xi ) associated with each xiI A �nite set C of constraints

By a constraint C on X we mean a subset of D(xi1)× . . .×D(xik ),k > 0, where xi1 , . . . , xik is a subsequence of x1, . . . , xn. However,no speci�c syntax is assumed for specifying constraints.

We say that an n-tuple s := (s1, . . . , sn) ∈ D(x1)× . . .× D(xn)satis�es a constraint C ∈ C on the variables xi1 . . . . , xik if for therespective subsequence sC = (si1 , . . . , sik ) we have that sC ∈ C .If it satis�es all C ∈ C we say s is a solution to the CSP.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 5: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Constraint satisfaction problems

De�nition

A constraint satisfaction problem (CSP) consists of:

I A �nite sequence of variables X := x1, . . . , xn, n > 0

I A domain D(xi ) associated with each xiI A �nite set C of constraints

By a constraint C on X we mean a subset of D(xi1)× . . .×D(xik ),k > 0, where xi1 , . . . , xik is a subsequence of x1, . . . , xn. However,no speci�c syntax is assumed for specifying constraints.We say that an n-tuple s := (s1, . . . , sn) ∈ D(x1)× . . .× D(xn)satis�es a constraint C ∈ C on the variables xi1 . . . . , xik if for therespective subsequence sC = (si1 , . . . , sik ) we have that sC ∈ C .If it satis�es all C ∈ C we say s is a solution to the CSP.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 6: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

n Queens

Given an n × n chessboard, the task is to place n queens on theboard so that no attack is possible.

I n variables x1, . . . , xn withD(xi ) = {1, . . . , n}, denoting theposition of the queen in the i-thcolumn.

I constraint all_di�erent(x1, . . . , xn).I for i ∈ {1, . . . , n − 1} and

j ∈ {i + 1, . . . , n}I constraint xi − xj 6= i − j

(NW-SE diagonal).I constraint xi − xj 6= j − i

(SW-NE diagonal).

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 7: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Tail AssignmentMattias Grönkvist, PhD thesis, Chalmers University of Technology, 2005

Given an airline timetable, the task is toassign a single aircraft, identi�ed by itsunique tail number, to each �ight leg in thetimetable while obeying operationalconstraints. In other words: For eachaircraft in our �eet we want to establish aroute, consisting of a sequence of �ight legs.

De�nition

I Let F = {f1, . . . , fn} be the set of �ight legs / activities.

I Let T = {t1, . . . , tm} be the set of tail numbers / vehicles.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 8: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Tail AssignmentMattias Grönkvist, PhD thesis, Chalmers University of Technology, 2005

Given an airline timetable, the task is toassign a single aircraft, identi�ed by itsunique tail number, to each �ight leg in thetimetable while obeying operationalconstraints. In other words: For eachaircraft in our �eet we want to establish aroute, consisting of a sequence of �ight legs.

De�nition

I Let F = {f1, . . . , fn} be the set of �ight legs / activities.

I Let T = {t1, . . . , tm} be the set of tail numbers / vehicles.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 9: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Modelling the tail assignment problem

We introduce the following variables, organized in three arrays:

I suc = [suc1, . . . , sucn], where D(suci ) ⊆ F initially containsthe possible successors to activity fi .

I pre = [pre1, . . . , pren], where D(prei ) ⊆ F initially containsthe possible predecessors to activity fi .

I veh = [veh1, . . . , vehn], where D(vehi ) ⊆ T initially containsall aircraft that are allowed to operate fi .

Redundancy: A solution is either characterized by following thesuc/pre links or by grouping activities wrt. the veh variables.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 10: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Modelling the tail assignment problem

We introduce the following variables, organized in three arrays:

I suc = [suc1, . . . , sucn], where D(suci ) ⊆ F initially containsthe possible successors to activity fi .

I pre = [pre1, . . . , pren], where D(prei ) ⊆ F initially containsthe possible predecessors to activity fi .

I veh = [veh1, . . . , vehn], where D(vehi ) ⊆ T initially containsall aircraft that are allowed to operate fi .

Redundancy: A solution is either characterized by following thesuc/pre links or by grouping activities wrt. the veh variables.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 11: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Simple example activity network

F = {f1, f2, f3, f4, f5, f6}, T = {t1, t2}

suc1 = f3 suc3 = f6

t1: f1 ←− −−− −→ f3 ←− −−− −→ f6

pre3 = f1 pre6 = f3

=⇒ veh1 = veh3 = veh6 = t1

suc2 = f4 suc4 = f5

t2: f2 ←− −−− −→ f4 ←− −−− −→ f5

pre4 = f2 pre5 = f4

=⇒ veh2 = veh4 = veh5 = t2

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 12: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Simple example activity network

F = {f1, f2, f3, f4, f5, f6}, T = {t1, t2}

suc1 = f3 suc3 = f6

t1: f1 ←− −−− −→ f3 ←− −−− −→ f6

pre3 = f1 pre6 = f3

=⇒ veh1 = veh3 = veh6 = t1

suc2 = f4 suc4 = f5

t2: f2 ←− −−− −→ f4 ←− −−− −→ f5

pre4 = f2 pre5 = f4

=⇒ veh2 = veh4 = veh5 = t2

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 13: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Simple example activity network

F = {f1, f2, f3, f4, f5, f6}, T = {t1, t2}

suc1 = f3

suc3 = f6

t1: f1 ←− −−− −→ f3 ←− −−− −→ f6pre3 = f1

pre6 = f3

=⇒ veh1 = veh3 = veh6 = t1

suc2 = f4 suc4 = f5

t2: f2 ←− −−− −→ f4 ←− −−− −→ f5

pre4 = f2 pre5 = f4

=⇒ veh2 = veh4 = veh5 = t2

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 14: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Simple example activity network

F = {f1, f2, f3, f4, f5, f6}, T = {t1, t2}

suc1 = f3 suc3 = f6t1: f1 ←− −−− −→ f3 ←− −−− −→ f6

pre3 = f1 pre6 = f3

=⇒ veh1 = veh3 = veh6 = t1

suc2 = f4 suc4 = f5t2: f2 ←− −−− −→ f4 ←− −−− −→ f5

pre4 = f2 pre5 = f4

=⇒ veh2 = veh4 = veh5 = t2

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 15: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Simple example activity network

F = {f1, f2, f3, f4, f5, f6}, T = {t1, t2}

suc1 = f3 suc3 = f6t1: f1 ←− −−− −→ f3 ←− −−− −→ f6

pre3 = f1 pre6 = f3

=⇒ veh1 = veh3 = veh6 = t1

suc2 = f4 suc4 = f5t2: f2 ←− −−− −→ f4 ←− −−− −→ f5

pre4 = f2 pre5 = f4

=⇒ veh2 = veh4 = veh5 = t2

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 16: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Modelling the tail assignment problem (contd.)Adding constraints

I To keep suc and pre consistent, we post a constraintinverse(suc, pre) which is de�ned as follows:

fi ∈ D(sucj)⇐⇒ fj ∈ D(prei )

I To ensure disjointness for all routes we add the constraintall_different(suc).

Note: During search we will branch only on the suc variables.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 17: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Modelling the tail assignment problem (contd.)Adding constraints

I To keep suc and pre consistent, we post a constraintinverse(suc, pre) which is de�ned as follows:

fi ∈ D(sucj)⇐⇒ fj ∈ D(prei )

I To ensure disjointness for all routes we add the constraintall_different(suc).

Note: During search we will branch only on the suc variables.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 18: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Modelling the tail assignment problem (contd.)Adding constraints

I To connect veh with suc and pre we add a customtunneling constraint. This is propagated each time a variableis �xed and in turn posts the respective constraints toreestablish concistency:

vehf == t ⇒ POST element(sucf , veh, t)

POST element(pref , veh, t)

sucf == f ′ ⇒ POST vehf = vehf ′

pref == f ′ ⇒ POST vehf = vehf ′

I To improve propagation and thereby computationalperformance, further constraints can be posted.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 19: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Modelling the tail assignment problem (contd.)Adding constraints

I To connect veh with suc and pre we add a customtunneling constraint. This is propagated each time a variableis �xed and in turn posts the respective constraints toreestablish concistency:

vehf == t ⇒ POST element(sucf , veh, t)

POST element(pref , veh, t)

sucf == f ′ ⇒ POST vehf = vehf ′

pref == f ′ ⇒ POST vehf = vehf ′

I To improve propagation and thereby computationalperformance, further constraints can be posted.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 20: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Outline

Constraint ProgrammingBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Randomizing SearchBacktrack SearchRandomized BranchingRestarts

Results & OutlookPerformance ResultsConclusion & Outlook

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 21: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Review of standard backtrack search

We recall the simple yet elegant concept of backtrack search, acommon way to explore a search space:

1. Choose a variable xi that is not yet assigned.

2. Pick a value z ∈ D(xi ) and instantiate xi to this value.

3. Check if this instantiation is consistent with all constraints.I Yes: Repeat recursively from step 1 until a solution is found

(or CSP is proven to be inconsistent).I No: Undo instantiation and try a di�erent variable and/or

value. If all options have failed, perform a backtrack bymarking the preceding instantiation inconsistent.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 22: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Review of standard backtrack search

We recall the simple yet elegant concept of backtrack search, acommon way to explore a search space:

1. Choose a variable xi that is not yet assigned.

2. Pick a value z ∈ D(xi ) and instantiate xi to this value.

3. Check if this instantiation is consistent with all constraints.I Yes: Repeat recursively from step 1 until a solution is found

(or CSP is proven to be inconsistent).I No: Undo instantiation and try a di�erent variable and/or

value. If all options have failed, perform a backtrack bymarking the preceding instantiation inconsistent.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 23: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Variable selection

We extend existing, established heuristics for variable selection:

I min-size: Branch on the variable with the currently smallestdomain size (often also called �fail-�rst�).

I min-degree: Branch on the variable with the currently smallestdegree, i.e. the number of constraints related to it.

Simple randomized extension:

I In case of ties we pick one candidate at random (uniformlydistributed). [Gomes et al., `98]

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 24: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Variable selection

We extend existing, established heuristics for variable selection:

I min-size: Branch on the variable with the currently smallestdomain size (often also called �fail-�rst�).

I min-degree: Branch on the variable with the currently smallestdegree, i.e. the number of constraints related to it.

Simple randomized extension:

I In case of ties we pick one candidate at random (uniformlydistributed). [Gomes et al., `98]

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 25: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Value selection

The nonrandomized value selection for the tail assignment problemis based on the following observation [Grönkvist, `06]:

I Succeeding activities should be chosen by increasingconnection time.

Hence we order the activities in F by increasing start time, s.t.start(fi ) ≤ start(fj) if i < j .

I Picking the lowest value is then equivalent to making theshortest possible connection.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 26: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Value selection

The nonrandomized value selection for the tail assignment problemis based on the following observation [Grönkvist, `06]:

I Succeeding activities should be chosen by increasingconnection time.

Hence we order the activities in F by increasing start time, s.t.start(fi ) ≤ start(fj) if i < j .

I Picking the lowest value is then equivalent to making theshortest possible connection.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 27: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Value selection (contd.)

For randomized value selection we obtained the best results withthe following scheme:

I With p, q ∈ (0, 1) choose the lowest value with probability p,the 2nd lowest with probability p · q, the 3rd lowest withprobability p · q2 etc. � in general, the i th lowest withprobability p · qi−1.

I Increasing values are chosen with decreasing probability.I For a given q, we can compute p to obtain a valid probability

distribution over all n possibilities.I For n→∞ we would have q → (1− p) and thus a geometric

distribution in the limit.

...but randomized variable/value selection is only half of the story!

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 28: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Value selection (contd.)

For randomized value selection we obtained the best results withthe following scheme:

I With p, q ∈ (0, 1) choose the lowest value with probability p,the 2nd lowest with probability p · q, the 3rd lowest withprobability p · q2 etc. � in general, the i th lowest withprobability p · qi−1.

I Increasing values are chosen with decreasing probability.I For a given q, we can compute p to obtain a valid probability

distribution over all n possibilities.I For n→∞ we would have q → (1− p) and thus a geometric

distribution in the limit.

...but randomized variable/value selection is only half of the story!

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 29: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Value selection (contd.)

For randomized value selection we obtained the best results withthe following scheme:

I With p, q ∈ (0, 1) choose the lowest value with probability p,the 2nd lowest with probability p · q, the 3rd lowest withprobability p · q2 etc. � in general, the i th lowest withprobability p · qi−1.

I Increasing values are chosen with decreasing probability.I For a given q, we can compute p to obtain a valid probability

distribution over all n possibilities.I For n→∞ we would have q → (1− p) and thus a geometric

distribution in the limit.

...but randomized variable/value selection is only half of the story!

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 30: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

The need for restarts

I The actual run of the randomized search algorithm depends onthe random seed, the number the random number generator isinitialized with at the start.

I Just as the nonrandomized search, for speci�c random seedsthe randomized search can get stuck, exploring a part of thesearch tree that does not contain a solution (�thrashing�).

I But, as we will see, there is often the chance for short runsthat �nd a solution quickly.

I Hence, after a certain number of backtracks, we restart thesearch from the root of the search tree, with a di�erentrandom seed.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 31: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

The need for restarts

I The actual run of the randomized search algorithm depends onthe random seed, the number the random number generator isinitialized with at the start.

I Just as the nonrandomized search, for speci�c random seedsthe randomized search can get stuck, exploring a part of thesearch tree that does not contain a solution (�thrashing�).

I But, as we will see, there is often the chance for short runsthat �nd a solution quickly.

I Hence, after a certain number of backtracks, we restart thesearch from the root of the search tree, with a di�erentrandom seed.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 32: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

The need for restarts

I The actual run of the randomized search algorithm depends onthe random seed, the number the random number generator isinitialized with at the start.

I Just as the nonrandomized search, for speci�c random seedsthe randomized search can get stuck, exploring a part of thesearch tree that does not contain a solution (�thrashing�).

I But, as we will see, there is often the chance for short runsthat �nd a solution quickly.

I Hence, after a certain number of backtracks, we restart thesearch from the root of the search tree, with a di�erentrandom seed.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 33: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Restart strategies

The cuto� parameter (the number of allowed backtracks before thenext restart) can be determined in multiple ways:

I Restart after a constant number of backtracks. [Gomes et al.,`98]

I Increase the cuto� parameter geometrically after each restart.[Walsh, `99]

I Restart after 1, 1, 2, 1, 1, 2, 4 . . . backtracks (so-called�Universal Strategy�), possibly multiplied by a constant. [Lubyet al., `93]

Note: By memorizing previously explored parts of the search space,one can conserve the search's completeness.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 34: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookBacktrack SearchRandomized BranchingRestarts

Restart strategies

The cuto� parameter (the number of allowed backtracks before thenext restart) can be determined in multiple ways:

I Restart after a constant number of backtracks. [Gomes et al.,`98]

I Increase the cuto� parameter geometrically after each restart.[Walsh, `99]

I Restart after 1, 1, 2, 1, 1, 2, 4 . . . backtracks (so-called�Universal Strategy�), possibly multiplied by a constant. [Lubyet al., `93]

Note: By memorizing previously explored parts of the search space,one can conserve the search's completeness.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 35: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

Outline

Constraint ProgrammingBasic De�nitionsThe n Queens ProblemThe Tail Assignment Problem

Randomizing SearchBacktrack SearchRandomized BranchingRestarts

Results & OutlookPerformance ResultsConclusion & Outlook

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 36: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

n queens performance

I Performance benchmarks for 1000 ≤ n ≤ 1100.I Nonrandomized: variable with smallest domain �rst, median

value �rst (timeout of 1000 sec).I Randomized: random tie breaking for variable selection.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 37: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

n queens performance

I Performance benchmarks for 1000 ≤ n ≤ 1100.I Nonrandomized: variable with smallest domain �rst, median

value �rst (timeout of 1000 sec).I Randomized: random tie breaking for variable selection.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 38: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

Tail assignment performance

Four di�erent problem instances:

I 1D17V: 191 �ight legs, one vehicle type

I 1W17V: 727 �ight legs, one vehicle type

I 1D30V: 129 �ight legs, three vehicle types

I 3D74V: 780 �ight legs, nine vehicle types

Backtracks required for �nding a solution with nonrandomizedsearch:

1D17V 1W17V 1D30V 3D74V

min-size 8 1 > 1000000 5min-degree 14 1 > 1000000 > 1000000

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 39: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

Tail assignment performance

Four di�erent problem instances:

I 1D17V: 191 �ight legs, one vehicle type

I 1W17V: 727 �ight legs, one vehicle type

I 1D30V: 129 �ight legs, three vehicle types

I 3D74V: 780 �ight legs, nine vehicle types

Backtracks required for �nding a solution with nonrandomizedsearch:

1D17V 1W17V 1D30V 3D74V

min-size 8 1 > 1000000 5min-degree 14 1 > 1000000 > 1000000

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 40: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

Randomized search cost distributionComputed over 2000 runs for each combination

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 41: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

Randomized search cost distribution (contd.)Computed over 2000 runs for each combination

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 42: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

Average performance using restarts

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 43: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

The End

We can observe the following:

I We added randomized elements to backtrack search in ageneral and straightforward way.

I By introducing restarts, we exploited the presence ofrandomized short runs quite e�ectively.

I Summing up, proper use of randomization can make hard oreven infeasible problems (wrt. nonrandomized search) feasible.

Possible future directions:

I Apply to bigger problem instances (currently limited bymemory consumption).

I Extend our relaxed tail assignment model to cover allmaintenance constraints.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 44: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

The End

We can observe the following:

I We added randomized elements to backtrack search in ageneral and straightforward way.

I By introducing restarts, we exploited the presence ofrandomized short runs quite e�ectively.

I Summing up, proper use of randomization can make hard oreven infeasible problems (wrt. nonrandomized search) feasible.

Possible future directions:

I Apply to bigger problem instances (currently limited bymemory consumption).

I Extend our relaxed tail assignment model to cover allmaintenance constraints.

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 45: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

Thank you for your attention!

Comments? Questions? Criticism? Praise?

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP

Page 46: Randomization in Backtrack Search for Constraint Programminglotten/pub/aimlpres.pdfConstraint Programming Randomizing Search Results & Outlook Randomization in Backtrack Search for

Constraint ProgrammingRandomizing SearchResults & OutlookPerformance ResultsConclusion & Outlook

Thank you for your attention!

Comments? Questions? Criticism? Praise?

L. Otten, M. Grönkvist, D. Dubhashi Randomization in Backtrack Search for CP