Sei sulla pagina 1di 14

Lecture  15:  CP  Search

©  J.  Christopher  Beck  2015 1


Outline
n Standard  CP  Search
n Scheduling  Specific  Branching  Heuristics
n Problems  to  Try

©  J.  Christopher  Beck  2015 2


Readings
n P  Ch  5.5,  D.2,  D.3

©  J.  Christopher  Beck  2015 3


From Lecture 10

Idea  #1:  Partitioning


n Add  constraint  to  the  original  problem  
to  form  a  partition:  P1,  P2,  P3,  …
n Partitions  are  easier  to  solve
n Partitions,  sub-­partitions,   sub-­sub-­
partitions
n Solution  is  the  best  one  from  all  the  
partitions

©  J.  Christopher  Beck  2015 4


Standard  CP  Search
n Tree  Search
n a,  b,  c  є {0,  1} Branch

a  =  0 a  =  1

b  =  0 b  =  1 b  =  0 b  =  1

c  =  0 c  =  1 c  =  0 c  =  1 c  =  0 c  =  1 c  =  0 c  =  1

In pure CSP there is no optimization But this does not mean you
function! (think of the Crystal Maze)
©  J.  Christopher  Beck  2015 can’t use CP for optimization!5
Standard  CP  Search
n Branch-­and-­Infer
n at  each  node,  run  constraint  propagation  
n For  Constraint  Optimization  Problems:
n Branch-­Infer-­&-­Bound
n Partition/Inference/Relax  (see  Lecture  10)
n Often  bound  calculation  is  “hidden”  in  
constraint  propagation

©  J.  Christopher  Beck  2015 6


Basic  CP  B&B  (feasibility)
CPSearch(Problem P)
if propagate(P) == dead-end
return dead-end
if not all variables are assigned
value ordering V = choose variable in P variable ordering
heuristic x = choose value for V heuristic
if CPSearch(P + V=x) == solution
depth-first
search return solution
else return CPSearch(P + V≠x)
return solution
©  J.  Christopher  Beck  2015 7
MIP  vs  CP  Search
n Conceptually  the  same  thing  
n How  do  node  selection  &  branch  
selection  correspond  to  DFS,  variable  
ordering,  and  value  ordering?

©  J.  Christopher  Beck  2015 8


CP  Heuristics  for  Scheduling
n It  is  common  to  make  a  decision  
(branch)  about  the  sequence  of  a  pair  
of  activities.
n What  pair?
n Which  sequence  should  be  tried  first?

How do these map into variable


and value ordering heuristics?

©  J.  Christopher  Beck  2015 9


If you post Ai→Aj, how
much time is left in the
Slack “time window”?

slack(Ai,Aj) = lftj – esti – pi – pj

A1 15

A2 20
35 50 100 120

slack(A1,A2)  =  100  – 50  – 15  – 20  =  15  


slack(A2,A1)  =  120  – 35  – 15  – 20  =  50  
©  J.  Christopher  Beck  2015 10
Note: Simplification of the book

MinSlack  Heuristic
n Find  operation  pair  with  smallest  slack
n Post  the  opposite  sequence
n Example
n slack(A  → B)  =  50,  slack(B  → A)  =  25
n slack(A  → C)  =  150,  slack(C  → A)  =  5
n slack(B  →    C)  =  15,  slack(C  → B)  =  50

n Pick  A,C  and  post  A  →  C


©  J.  Christopher  Beck  2015 11
Branch  on  Sequence

A1 → A2 A2  →  A1

A4  →   A1

©  J.  Christopher  Beck  2015 12


CBA  &  Slack
n Find  all  CBA  inferences
n Find  first  heuristic  decision
based  on  slack A1 10
20 50
A2 5
30 50
A3 20
0 50
A4 5
10 40
©  J.  Christopher  Beck  2015 13
CP  on  JSP
n Run  CP  on  our  JSP  problem
n Minimize  makespan using:
n CBA,  EF  Exclusion
n Min  Slack  Heuristic
Jobs Processing  times
0 J0R0[15]   J0R1[50]   J0R2[60]
1 J1R1[50]   J1R0[50]   J1R2[15]
2 J2R0[30]   J2R1[15]   J2R2[20]
©  J.  Christopher  Beck  2015 14

Potrebbero piacerti anche