© J. Christopher Beck Lecture 15: CP Search
© J. Christopher Beck Outline Quick CP Review Standard CP Search Scheduling Specific Branching Heuristics
© J. Christopher Beck Readings P Ch 5.5, D.2, D.3
© J. Christopher Beck Generic CP Algorithm Assert Commitment Propagators Start Success Solution? Make Heuristic Decision Backtrack Technique Failure Nothing to retract? Dead-end?
© J. Christopher Beck Constraint Satisfaction Problem (CSP) Given: V, a set of variables {v 0, v 1, …, v n } D, a set of domains {D 0, D 1, …, D n } C, a set of constraints {c 0, c 1, …, c m } Each constraint, c i, has a scope c i (v 0, v 2, v 4, v 117, …), the variables that it constrains From Lecture 13
© J. Christopher Beck Idea #1: Partitioning Add constraint to the original problem to form a partition: P 1, P 2, P 3, … Partitions are easier to solve Partitions, sub-partitions, sub-sub- partitions Solution is the best one from all the partitions From Lecture 11
© J. Christopher Beck Standard CP Search Tree Search a, b, c є {0, 1} a = 0a = 1 b = 0b = 1 c = 0c = 1c = 0c = 1c = 0c = 1c = 0c = 1 b = 0b = 1 Branch In CSP there is no optimization function! (think of the Crystal Maze)
© J. Christopher Beck Standard CP Search Branch-and-Infer at each node, run constraint propagation For Constraint Optimization Problems: Branch-Infer-&-Bound Partition/Inference/Relax (see Lecture 11) Often bound calculation is “hidden” in constraint propagation
© J. Christopher Beck Basic MIP B&B Q.push(root) while Q is not empty n = Q.pop() solve LP(n) if better than incumbent if integral update incumbent else v = choose branching variable Q.push(children(n,v)) Priority queue (node selection) Relaxation Branching variable selection From Lecture 12
© J. Christopher Beck Basic CP BI&B CPSearch(Problem P) if propagate(P) == dead-end return dead-end if not all variables are assigned V = choose variable in P x = choose value for V if CPSearch(P + V=x) == solution return solution else return CPSearch(P + V≠x) return solution depth-first search variable ordering heuristic value ordering heuristic
© J. Christopher Beck MIP vs CP Search Conceptually (almost) the same thing Nice exam question: How do node selection & branch selection correspond to DFS, variable ordering, and value ordering?
© J. Christopher Beck CP Heuristics for Scheduling It is common to make a decision (branch) about the sequence of a pair of activities. What pair? Which sequence should be tried first? How do these map into variable and value ordering heuristics?
© J. Christopher Beck Slack slack(A i,A j ) = lft j – est i – p i – p j A A slack(A 1,A 2 ) = 100 – 50 – 15 – 20 = 15 slack(A 2,A 1 ) = 120 – 35 – 15 – 20 = 50 If you post A i A j, how much time is left between the end of A j and lft j ?
© J. Christopher Beck MinSlack Heuristic Find operation pair with smallest slack Post the opposite sequence Example slack(A B) = 50, slack(B A) = 25 slack(A C) = 150, slack(C A) = 5 slack(B C) = 15, slack(C B) = 50 Pick A,C and post A C Note: The text is wrong here!
© J. Christopher Beck Branch on Sequence A1 A2A2 A1 … A4 A1 …
© J. Christopher Beck CBA & Slack Find all CBA inferences Find first heuristic decision based on slack A A A 2 5 A
© J. Christopher Beck Generic CP Algorithm Assert Commitment Propagators Start Success Solution? Make Heuristic Decision Backtrack Technique Failure Nothing to retract? Dead-end?
© J. Christopher Beck CP on JSP Run CP on our JSP problem Use CBA, EF Exclusion Min Slack Heuristic JobsProcessing times 0 J0R0[15] J0R1[50] J0R2[60] 1 J1R1[50] J1R0[50] J1R2[15] 2 J2R0[30] J2R1[15] J2R2[20]