learning to use different word endings such as â edâ and ...
Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different...
Transcript of Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different...
![Page 1: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/1.jpg)
Put a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive numbers
![Page 2: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/2.jpg)
Constraint Programming An Introduction
by example
with help from Toby Walsh, Chris Beck, Barbara Smith, Peter van Beek, Edward Tsang, ...
![Page 3: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/3.jpg)
A Puzzle
⢠Place numbers 1 through 8 on nodes
â Each number appears exactly once
?
?
?
?
?
?
? ?
â No connected
nodes have
consecutive
numbers
You have
8 minutes!
![Page 4: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/4.jpg)
Heuristic Search Which nodes are hardest to number?
?
?
?
?
?
?
? ?
![Page 5: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/5.jpg)
Heuristic Search
?
?
?
?
?
?
? ?
![Page 6: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/6.jpg)
Heuristic Search
?
?
?
?
?
?
? ?
Which are the least constraining values to use?
![Page 7: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/7.jpg)
Heuristic Search
?
1
?
?
8
?
? ?
Values 1 and 8
![Page 8: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/8.jpg)
Heuristic Search
?
1
?
?
8
?
? ?
Values 1 and 8
Symmetry means we donât need to consider: 8 1
![Page 9: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/9.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
We can now eliminate many values for other nodes
![Page 10: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/10.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
{1,2,3,4,5,6,7,8}
![Page 11: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/11.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
{2,3,4,5,6,7}
![Page 12: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/12.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
{3,4,5,6}
![Page 13: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/13.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
{3,4,5,6}
By symmetry
{3,4,5,6}
![Page 14: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/14.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
{3,4,5,6}
{3,4,5,6}
{1,2,3,4,5,6,7,8}
![Page 15: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/15.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
{3,4,5,6}
{3,4,5,6}
{2,3,4,5,6,7}
![Page 16: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/16.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
{3,4,5,6}
{3,4,5,6}
{3,4,5,6}
![Page 17: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/17.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
{3,4,5,6}
By symmetry
{3,4,5,6}
{3,4,5,6}
{3,4,5,6}
![Page 18: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/18.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
{3,4,5,6}
{3,4,5,6,7}
{3,4,5,6}
{3,4,5,6}
{3,4,5,6}
{2,3,4,5,6}
![Page 19: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/19.jpg)
Inference/propagation
?
1
?
?
8
?
? ?
{3,4,5,6}
{3,4,5,6,7}
{3,4,5,6}
{3,4,5,6}
{3,4,5,6}
{2,3,4,5,6}
Value 2 and 7 are left in just one variable domain each
![Page 20: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/20.jpg)
Inference/propagation
?
1
?
?
8
?
2 7
{3,4,5,6}
{3,4,5,6,7}
{3,4,5,6}
{3,4,5,6}
{3,4,5,6}
{2,3,4,5,6}
And propagate âŚ
![Page 21: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/21.jpg)
Inference/propagation
?
1
?
?
8
?
2 7
{3,4,5}
{3,4,5,6,7}
{3,4,5}
{3,4,5,6}
{3,4,5,6}
{2,3,4,5,6}
And propagate âŚ
![Page 22: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/22.jpg)
Inference/propagation
?
1
?
?
8
?
2 7
{3,4,5}
{3,4,5,6,7}
{3,4,5}
{4,5,6}
{4,5,6}
{2,3,4,5,6}
And propagate âŚ
![Page 23: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/23.jpg)
Inference/propagation
?
1
?
?
8
?
2 7
{3,4,5}
{3,4,5}
{4,5,6}
{4,5,6}
Guess a value, but be prepared to backtrack âŚ
![Page 24: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/24.jpg)
Inference/propagation
3
1
?
?
8
?
2 7
{3,4,5}
{3,4,5}
{4,5,6}
{4,5,6}
Guess a value, but be prepared to backtrack âŚ
![Page 25: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/25.jpg)
Inference/propagation
3
1
?
?
8
?
2 7
{3,4,5}
{3,4,5}
{4,5,6}
{4,5,6}
And propagate âŚ
![Page 26: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/26.jpg)
Inference/propagation
3
1
?
?
8
?
2 7
{4,5}
{5,6}
{4,5,6}
And propagate âŚ
![Page 27: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/27.jpg)
Inference/propagation
3
1
?
?
8
?
2 7
{4,5}
{5,6}
{4,5,6}
Guess another value âŚ
![Page 28: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/28.jpg)
Inference/propagation
3
1
?
5
8
?
2 7
{4,5} {4,5,6}
Guess another value âŚ
![Page 29: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/29.jpg)
Inference/propagation
3
1
?
5
8
?
2 7
{4,5} {4,5,6}
And propagate âŚ
![Page 30: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/30.jpg)
Inference/propagation
3
1
?
5
8
?
2 7
{4} {4,6}
And propagate âŚ
![Page 31: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/31.jpg)
Inference/propagation
3
1
4
5
8
?
2 7
{4} {4,6}
One node has only a single value left âŚ
![Page 32: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/32.jpg)
Inference/propagation
3
1
4
5
8
6
2 7
{6}
![Page 33: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/33.jpg)
Solution
3
1
4
5
8
6
2 7
![Page 34: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/34.jpg)
![Page 35: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/35.jpg)
![Page 36: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/36.jpg)
![Page 37: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/37.jpg)
The Core of Constraint
Computation
⢠Modelling
â Deciding on variables/domains/constraints
⢠Heuristic Search
⢠Inference/Propagation
⢠Symmetry
⢠Backtracking
![Page 38: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/38.jpg)
A Commercial Reality
⢠First-tier software vendors use CP technology
![Page 39: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/39.jpg)
Hardness
⢠The puzzle is actually a hard problem
â NP-complete
![Page 40: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/40.jpg)
Constraint programming
⢠Model problem by specifying constraints on
acceptable solutions
â define variables and domains
â post constraints on these variables
⢠Solve model
â choose algorithm
⢠incremental assignment / backtracking search
⢠complete assignments / stochastic search
â design heuristics
![Page 41: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/41.jpg)
Constraint satisfaction
⢠Constraint satisfaction problem (CSP) is a triple <V,D,C> where:
â V is set of variables
â Each X in V has set of values, D_X
⢠Usually assume finite domain
⢠{true,false}, {red,blue,green}, [0,10], âŚ
â C is set of constraints
Goal: find assignment of values to variables to satisfy all the constraints
![Page 42: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/42.jpg)
How complex?
![Page 43: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/43.jpg)
Assume ⢠n variables ⢠each with a domian size of m ⢠how many states might we consider?
![Page 44: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/44.jpg)
Example CSP
⢠Variable, vi for each node
⢠Domain of {1, âŚ, 8}
⢠Constraints
â All values used
allDifferent(v1 v2 v3 v4 v5 v6 v7 v8)
â No consecutive numbers for adjoining nodes
|v1 - v2 | > 1
|v1 - v3 | > 1
âŚ
?
?
?
?
?
?
? ?
![Page 45: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/45.jpg)
Constraints
⢠Constraints are tuples <S,R> where
â S is the scope, [X1,X2, ⌠Xm]
⢠list of variables to which constraint applies
â R is relation specifying allowed values (goods)
⢠Subset of D_X1 x D_X2 x ⌠x D_Xm
⢠May be specified intensionally or extensionally
![Page 46: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/46.jpg)
Constraints
⢠Extensional specification
â List of goods (or for tight constraints, nogoods)
⢠Intensional specification
â X1 =/= X2
â 5*X1 + 6*X2 < X3
â alldifferent([X1,X2,X3,X4]), âŚ
![Page 47: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/47.jpg)
more examples?
![Page 48: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/48.jpg)
Do you know any constraint satisfaction problems?
To a man with a hammer, everything looks like a nail.
![Page 49: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/49.jpg)
![Page 50: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/50.jpg)
The n-queens problem
A demo in Oz
Scotsman 4/12/2003
?
18
10 20
49
7
177
In the pyramid above, two adjacent bricks added together give the valueof the brick above. Find the value for the brick marked ?
![Page 51: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/51.jpg)
Exam timetabling
![Page 52: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/52.jpg)
An Example, Exam Timetabling
⢠Someone timetables the exams ⢠We have a number of courses to examine
⢠how many? ⢠Dept has 36 ⢠Faculty? ⢠University?
⢠There are constraints ⢠if a student S takes courses Cx and Cy
⢠Cx and Cy cannot be at same time! ⢠If Cy and Cz have no students in common
⢠they can go in room R1 if there is space ⢠Temporal and resource constraints
![Page 53: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/53.jpg)
An Example, Exam Timetabling
⢠Represent as graph colouring ⢠vertices are courses ⢠colours are time ⢠vertices have weight (room requirements) ⢠edge connects vertices of diff colour
⢠How complex is this ⢠if we have n vertices and k times
⢠an n-digit number to the base k? ⢠How would you solve this
⢠backtracking search? ⢠Greedy? ⢠Something else
⢠GA? ⢠SA, TS, GLS, HC, ...
![Page 54: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/54.jpg)
An Example, Exam Timetabling
⢠How does the person solve this? ⢠Is that person intelligent? ⢠Is there always a solution? ⢠If there isnât, do we want to know why?
⢠Do you think they can work out âwhyâ?
![Page 55: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/55.jpg)
Crossword puzzle generation
![Page 56: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/56.jpg)
![Page 57: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/57.jpg)
1 2 3 4 5 6
4
7
An example
Make a crossword puzzle!
Given the above grid and a dictionary, fill it.
Then go get the clues (not my problem)
![Page 58: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/58.jpg)
1A 1 across
4D 4 down
2D 2 down
4A 4 across
7D 7 down
1 2 3 4 5 6
4
7 1A 4D
2D
7D
4A
An example
Variables
![Page 59: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/59.jpg)
1 2 3 4 5 6
4
7 1A 4D
2D
7D
4A
An example
1A-4D: 4th of 1A equals 1st of 4D
1A-2D: 2nd of 1A equals 1st of 2D
2D-4A: 4th of 2D equals 2nd of4D
4D-4A: 4th of 4A equals 4th of 4D
4A-7D: 7th of 4A equals 2nd of 7D
Constraints
![Page 60: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/60.jpg)
1 2 3 4 5 6
4
7 1A 4D
2D
7D
4A
An example
1A: any 6 letter word
4A: any 8 letter word
4D: any 5 letter word
2D: any 7 letter word
7D: any 3 letter word
Domains (also unary constraints!)
![Page 61: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/61.jpg)
1 2 3 4 5 6
4
7 1A 4D
2D
7D
4A
An example
Find an assignment of values to variables, from their domains,
such that the constraints are
satisfied (or show that no assignment
exists)
A CSP!
![Page 62: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/62.jpg)
Choose a variable
Assign it a value
Check compatibility
If not compatible try a new value
If no values remain re-assign previous variable
1 2 3 4 5 6
4
7 1A 4D
2D
7D
4A
An example
Good old fashioned BT!
![Page 63: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/63.jpg)
What variable should I choose?
1 2 3 4 5 6
4
7 1A 4D
2D
7D
4A
Questions?
Decisions, decisions!
What value should I choose?
What reasoning can I do when making an assignment?
What reasoning can I do on a dead end?
![Page 64: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/64.jpg)
1 2 3 4 5 6
4
7
An example
Is there an alternative representation?
![Page 65: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/65.jpg)
Problems of interest to CP
These are some of the problems that have been tackled by CP
⢠factory scheduling (JSSP) ⢠vehicle routing (VRP) ⢠packing problems (NumPart and BinPack) ⢠timetabling (exams, lectures, trains) ⢠configuration and design (hardware) ⢠workforce management (call centres, etc) ⢠car sequencing (assembly line scheduling) ⢠supertree construction (bioinformatics) ⢠network design (telecoms problem) ⢠gate arrival (at airports) ⢠logistics (Desert Storm an example) ⢠aircraft maintenance schedules ⢠aircraft crew scheduling (commercial airlines) ⢠air cover for naval fleet
![Page 66: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/66.jpg)
What will be covered in course
⢠the technology behind constraint programming (cp) ⢠cp in JChoco/java ⢠modelling and solving problems ⢠the state of the art
![Page 67: Put a different number in each circle (1 to 8) such that ...pat/cpM/slides/intro.pdfPut a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive](https://reader034.fdocuments.in/reader034/viewer/2022051608/603f6b219e8bae73617316f4/html5/thumbnails/67.jpg)