© J. Christopher Beck Lecture 12: Constraint Programming 2
© J. Christopher Beck Outline Quick CP Review More propagation Edge Finding The Overall CP Loop
© J. Christopher Beck The Core of CP Modeling How to represent the problem Heuristic search How to branch How much effort to find a good branch Inference/propagation How much effort Backtracking
© 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-Based Analysis (CBA) Operations on the same unary capacity resource What can you infer here?
© J. Christopher Beck CBA Rules For all pairs of activities, A i and A j : Case 1: If lft i – est j < dur i + dur j lft j – est i then A i must be before A j. Case 2: If dur i + dur j > lft j – est i and dur i + dur j > lft i – est j then dead-end. Case 3: If dur i + dur j lft j – est i and dur i + dur j lft i – est j then either OK. On the same unary-capacity resource
© J. Christopher Beck This Lecture Another propagator Edge Finding Exclusion “Big Picture CP” Solve the cut out example
© J. Christopher Beck Edge-Finding Exclusion S est(S) lft(S) 25
© J. Christopher Beck Edge-Finding Exclusion Sest(S)lft(S)
© J. Christopher Beck Exclusion Rules For all non-empty subsets, S, and activities A S: (lft(S) - est(S) < dur A + dur(S)) (lft(S) - est A < dur A + dur(S)) est A est(S) + dur(S) (lft(S) - est(S) < dur A + dur(S)) (lft A - est(S) < dur A + dur(S)) lft A lft(S) - dur(S) On the same, unary capacity resource
© J. Christopher Beck Edge Finding Exclusion Run CBA & Edge Finding Exclusion on the following activities A A A
© J. Christopher Beck Propagators Summary Analyze the current state in order to find new constraints that are implied Make commitments (e.g., remove values) that would otherwise have to be searched over Never make a mistake!
© J. Christopher Beck Heuristics/Branching Use the structure of the search state (e.g., flexibility) to guide the heuristic decisions (“commitment”) Could be mistaken – and so you might need to backtrack
© 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 Cut Out Problem Run CP on the cut out problem Use CBA, EF Exclusion Flexibility Heuristic Activities Jobs1234 1M1, 9M2, 8M3, 4M4, 4 2M1, 5M2, 6M4, 3M3, 6 3M3, 10M1, 4M2, 9M4, 2