constraint satisfaction patrick prosser. an example, exam timetabling someone timetables the exams...
TRANSCRIPT
![Page 1: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/1.jpg)
Constraint Satisfaction
Patrick Prosser
![Page 2: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/2.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 3: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/3.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 4: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/4.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 5: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/5.jpg)
A CSP
• A csp has• n variables• each has a domain of (m) values• constraints define compatible tuples of values
• n-ary, binary• find an assignment
• of values to variables • that satisfies the constraints• or show none exists
• O(mn)
![Page 6: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/6.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 7: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/7.jpg)
1A 1 across
4D 4 down
2D 2 down
4A 4 across
7D 7 down
1 2 3 4 5 6
4
71A 4D
2D
7D
4A
An example
Variables
![Page 8: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/8.jpg)
1 2 3 4 5 6
4
71A 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 9: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/9.jpg)
1 2 3 4 5 6
4
71A 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 10: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/10.jpg)
1 2 3 4 5 6
4
71A 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 11: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/11.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
71A 4D
2D
7D
4A
An example
Good old fashioned BT!
![Page 12: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/12.jpg)
What variable should I choose?
1 2 3 4 5 6
4
71A 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 13: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/13.jpg)
Where’s the AI?
![Page 14: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/14.jpg)
Scene Labelling
David Waltz, MIT, 1975
![Page 15: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/15.jpg)
In a trihedral world, these are the only scenarios
![Page 16: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/16.jpg)
Label an edge as follows
Walk along the edge in this direction and the object is onthe right, and to your left is open space
+
This is an outside edge, with the object on both sides
-
This is an inside edge
![Page 17: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/17.jpg)
We now have the following cases- -
+
+ ++
- -
- -
- -
+
+ -
+
- -
+
+ +
-
![Page 18: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/18.jpg)
-- -
+
+
+
+
+
--+
+ +
A consistent labelling is an interpretation
The edges are the variables, labels their domains, meeting points are the constraints
![Page 19: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/19.jpg)
Another example: n-queens
• Place n non-attacking queens on an n x n chess board• representations?
There is a polynomial solution circa 1800That was BT
![Page 20: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/20.jpg)
It’s all just depth first search, right?
![Page 21: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/21.jpg)
BT Thrashes!
past
future
current variable v[i]
conflict with v[h]
past variable v[h]
future variable v[j]
![Page 22: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/22.jpg)
Another example: n-queens
• Forward Checking
![Page 23: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/23.jpg)
Forward Checking
1
2
3
4
5
6
7
9
8
NOTE: arrows go forward!
![Page 24: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/24.jpg)
• How to improve search• use a heuristic
• variable and/or value ordering• dynamic or static• Fail First?
• More inferencing at each search state• old trade off, knowledge versus search• maintain consistency
![Page 25: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/25.jpg)
Consistency• arc consistency
• what’s that then?• Propagate supports• deduce illegal values• polynomial at each search node
• AC can be specialised for special constraints• MAC
• the heart of constraint programming
![Page 26: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/26.jpg)
Give us a demo?
![Page 27: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/27.jpg)
Not just binary csp’s!• N-ary
• but can be mapped to binary• why bother with n-ary?
• allDiff, sum, permutation, marriage
• Not just arc consistency• path• inverse• restricted• singleton• When, what?
![Page 28: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/28.jpg)
•Applications• scheduling• timetabeling• frequency allocation• transportation• design• layouts• packing• ...
![Page 29: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/29.jpg)
• Toolkits• ILOG
• solver, scheduler, dispatcher• chip• choco• OZ• Eclipse• Jsolver• Screamer• CSPLab
![Page 30: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/30.jpg)
• Research Direction• reactivity and explanation
• retraction in particular• better heuristics• new search algorithms
• complete, quasi-complete, local• new levels of consistency• new specialised constraints• effects of representation• understanding the problem
• its structure and why it is hard
![Page 31: Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept](https://reader034.vdocument.in/reader034/viewer/2022051613/5515cacc55034693758b4acf/html5/thumbnails/31.jpg)
stop