© J. Christopher Beck 20051 Lecture 12: Constraint Programming 2.

Presentation on theme: "© J. Christopher Beck 20051 Lecture 12: Constraint Programming 2."— Presentation transcript:

© J. Christopher Beck 20051 Lecture 12: Constraint Programming 2

© J. Christopher Beck 2005 2 Outline Quick CP Review More propagation Edge Finding The Overall CP Loop

© J. Christopher Beck 2005 3 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 2005 4 Generic CP Algorithm Assert Commitment Propagators Start Success Solution? Make Heuristic Decision Backtrack Technique Failure Nothing to retract? Dead-end?

© J. Christopher Beck 2005 5 Constraint-Based Analysis (CBA) 20 3580 15 9050 Operations on the same unary capacity resource What can you infer here?

© J. Christopher Beck 2005 6 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 2005 7 This Lecture Another propagator Edge Finding Exclusion “Big Picture CP” Solve the cut out example

© J. Christopher Beck 2005 8 Edge-Finding Exclusion 100 20 15 10 15 0 1080 S est(S) lft(S) 25

© J. Christopher Beck 2005 9 Edge-Finding Exclusion 100 20 15 10 15 0 10 75 Sest(S)lft(S) 25 70100

© J. Christopher Beck 2005 10 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 2005 11 Edge Finding Exclusion Run CBA & Edge Finding Exclusion on the following activities A 3 4 12 A 1 6 17 A 2 5 0 1 11 1

© J. Christopher Beck 2005 12 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 2005 13 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 2005 14 Generic CP Algorithm Assert Commitment Propagators Start Success Solution? Make Heuristic Decision Backtrack Technique Failure Nothing to retract? Dead-end?

© J. Christopher Beck 2005 15 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

Similar presentations