Presentation is loading. Please wait.

Presentation is loading. Please wait.

© J. Christopher Beck 20051 Lecture 11: Constraint Programming 1.

Similar presentations


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

1 © J. Christopher Beck 20051 Lecture 11: Constraint Programming 1

2 © J. Christopher Beck 2005 2 Outline The Crystal Maze & CP Heuristics, propagation, B&B Propagation Temporal Propagation Constraint Based Analysis Heuristics Slack & Flexibility

3 © J. Christopher Beck 2005 3 Crystal Maze Place the numbers 1 through 8 in the nodes such that: Each number appears exactly once ? ? ? ? ? ? ?? –No connected nodes have consecutive numbers

4 © J. Christopher Beck 2005 4 Modeling Each node  a variable {1, …, 8}  values in the domain of each variable No consecutive numbers  a constraint (v i, v j )  |v i – v j | > 1 All values used  all-different constraint

5 © J. Christopher Beck 2005 5 Heuristic Search ? ? ? ? ? ? ?? 18 {1, 2, 3, 4, 5, 6, 7, 8}

6 © J. Christopher Beck 2005 6 Inference/Propagation ? ? ? ? ? ? ?? 18 {1, 2, 3, 4, 5, 6, 7, 8}

7 © J. Christopher Beck 2005 7 Inference/Propagation ? ? ? ? ? ? ?? 18 {3, 4, 5, 6} 72 64 35 {3, 4, 5, 6, 7}{2, 3, 4, 5, 6}

8 © J. Christopher Beck 2005 8 Branch-and-Bound Inference is a form of bounding Branches are pruned when we know there is no solution below them May need to backtrack (if the heuristic decision has made a mistake) In an optimization context, once a solution is found you need to backtrack to search for a better one

9 © J. Christopher Beck 2005 9 With CP You Are … Guaranteed to find a solution if one exists If not you can prove there is no solution But you need to have enough time! On average, for many problems you can find a solution within a reasonable time CP is commercially successful for scheduling and other applications

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

11 © J. Christopher Beck 2005 11 Heuristic Search or Propagation? ? ? ? ? ? ? ?? 18 {1, 2, 3, 4, 5, 6, 7, 8} There must be a 1 or 8 here. Why?

12 © J. Christopher Beck 2005 12 Propagators for Scheduling 3 examples Temporal propagation (easy) Constraint-based analysis (medium) Edge-finding (tricky) – next lecture

13 © J. Christopher Beck 2005 13 Temporal Propagation (Arc Consistency - AC) 20151015 0 100 [0[20[35[4540]60]75]85] 100 20151015 0 [20[40[55[6540]60]75]85]20 The same as CPM!

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

15 © J. Christopher Beck 2005 15 CBA Rules For all pairs of activities, A i and A j : Case 1: If lft i – est j < p i + p j  lft j – est i then A i must be before A j. Case 2: If p i + p j > lft j – est i and p i + p j > lft i – est j then dead-end. Case 3: If p i + p j  lft j – est i and p i + p j  lft i – est j then either OK. On the same unary-capacity resource

16 © J. Christopher Beck 2005 16 CBA Find all CBA inferences A 3 20 40 50 A 1 10 10 50 A 2 5 A 4 5 20 30 50 0


Download ppt "© J. Christopher Beck 20051 Lecture 11: Constraint Programming 1."

Similar presentations


Ads by Google