Chapter 3 Constraint Programming Paragraph 1 Puzzles, Domains, and - - PowerPoint PPT Presentation

chapter 3 constraint programming paragraph 1 puzzles
SMART_READER_LITE
LIVE PREVIEW

Chapter 3 Constraint Programming Paragraph 1 Puzzles, Domains, and - - PowerPoint PPT Presentation

Chapter 3 Constraint Programming Paragraph 1 Puzzles, Domains, and Constraints Who Owns the Fish? 1. The Brit lives in the red house. 2. The Swede keeps dogs as pets. 3. The Dane drinks tea. 4. The green house is on the left of the white


slide-1
SLIDE 1

Chapter 3 Constraint Programming Paragraph 1 Puzzles, Domains, and Constraints

slide-2
SLIDE 2

CS 195 - Intro to CO 2

Who Owns the Fish?

1. The Brit lives in the red house. 2. The Swede keeps dogs as pets. 3. The Dane drinks tea. 4. The green house is on the left of the white house. 5. The green house's owner drinks coffee. 6. The person who smokes Pall Mall rears birds. 7. The owner of the yellow house smokes Dunhill. 8. The man living in the center house drinks milk. 9. The Norwegian lives in the first house. 10. The man who smokes Blends lives next to the one who keeps cats. 11. The man who keeps the horse lives next to the man who smokes Dunhill. 12. The owner who smokes Bluemasters drinks beer. 13. The German smokes Prince. 14. The Norwegian lives next to the blue house. 15. The man who smokes Blends has a neighbor who drinks water.

slide-3
SLIDE 3

CS 195 - Intro to CO 3

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

slide-4
SLIDE 4

CS 195 - Intro to CO 4

Constrained Programming – An Archeological Puzzle

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A DA CA CE A E A DE CA AB

+ + + + + + = = =

D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-5
SLIDE 5

CS 195 - Intro to CO 5

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-6
SLIDE 6

CS 195 - Intro to CO 6

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-7
SLIDE 7

CS 195 - Intro to CO 7

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-8
SLIDE 8

CS 195 - Intro to CO 8

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-9
SLIDE 9

CS 195 - Intro to CO 9

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-10
SLIDE 10

CS 195 - Intro to CO 10

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-11
SLIDE 11

CS 195 - Intro to CO 11

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-12
SLIDE 12

CS 195 - Intro to CO 12

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-13
SLIDE 13

CS 195 - Intro to CO 13

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-14
SLIDE 14

CS 195 - Intro to CO 14

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-15
SLIDE 15

CS 195 - Intro to CO 15

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-16
SLIDE 16

CS 195 - Intro to CO 16

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-17
SLIDE 17

CS 195 - Intro to CO 17

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-18
SLIDE 18

CS 195 - Intro to CO 18

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-19
SLIDE 19

CS 195 - Intro to CO 19

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-20
SLIDE 20

CS 195 - Intro to CO 20

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-21
SLIDE 21

CS 195 - Intro to CO 21

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-22
SLIDE 22

CS 195 - Intro to CO 22

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-23
SLIDE 23

CS 195 - Intro to CO 23

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-24
SLIDE 24

CS 195 - Intro to CO 24

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-25
SLIDE 25

CS 195 - Intro to CO 25

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-26
SLIDE 26

CS 195 - Intro to CO 26

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-27
SLIDE 27

CS 195 - Intro to CO 27

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-28
SLIDE 28

CS 195 - Intro to CO 28

Constrained Programming – An Archeological Puzzle

DA CA CE A E A DE CA AB

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-29
SLIDE 29

CS 195 - Intro to CO 29

Constrained Programming – An Archeological Puzzle

41 21 20 1 1 40 21 19

+ + + + + + = = =

0,1,2,3,4,5,6,7,8,9 E 0,1,2,3,4,5,6,7,8,9 D 0,1,2,3,4,5,6,7,8,9 C 0,1,2,3,4,5,6,7,8,9 B 0,1,2,3,4,5,6,7,8,9 A D+1=D D=D AllDiff(A,B,C,D,E) 2C+1=D 2C=D E+A=A+10 E+A=A A+1=C A=C A+C+1=D A+C=D B+A=E+10 B+A=E

slide-30
SLIDE 30

CS 195 - Intro to CO 30

Who Owns the Fish?

1. The Brit lives in the red house. 2. The Swede keeps dogs as pets. 3. The Dane drinks tea. 4. The green house is on the left of the white house. 5. The green house's owner drinks coffee. 6. The person who smokes Pall Mall rears birds. 7. The owner of the yellow house smokes Dunhill. 8. The man living in the center house drinks milk. 9. The Norwegian lives in the first house. 10. The man who smokes Blends lives next to the one who keeps cats. 11. The man who keeps the horse lives next to the man who smokes Dunhill. 12. The owner who smokes Bluemasters drinks beer. 13. The German smokes Prince. 14. The Norwegian lives next to the blue house. 15. The man who smokes Blends has a neighbor who drinks water.

slide-31
SLIDE 31

CS 195 - Intro to CO 31

Constraint Programming

  • Model a combinatorial problem through

– Variables X with Domains D(X) – Constraints

X2 X3 X1

... ... Constraint Constraint Constraint D(X1) r,g,b D(X2) r D(X3) b r,

slide-32
SLIDE 32

Thank you! Thank you!