a simple assessed exercise ciaran mccreesh & patrick prosser + 21
TRANSCRIPT
![Page 1: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/1.jpg)
A simple assessed exercise
Ciaran McCreesh & Patrick Prosser + 21
![Page 2: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/2.jpg)
Simple assessed exercise
10 credit course • 10 weeks• 30 lectures• Equivalent to 100 hours in total
• 30 lectures• 20% coursework• Self study
![Page 3: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/3.jpg)
Simple assessed exercise
Simple exercise is 5% (about 1 day’s effort)Handed out 2nd week of courseGet students using CP (get hands dirty)Students have a rough idea about how CP works
![Page 4: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/4.jpg)
Simple assessed exercise
Goals• Must be easy to make progress• Must be interesting• Should be fun
• students want to solve this problem• Google-proof
![Page 5: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/5.jpg)
Simple assessed exercise
![Page 6: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/6.jpg)
Simple assessed exercise
![Page 7: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/7.jpg)
Simple assessed exercise
You are given n players to be allocated to m teams (where n % m = 0). There are constraints of the form together(i,j) and apart(i,j) where • together(i,j) means that players i and j must be in the same team• apart(i,j) that players i and j must be in different teams.
By default, players can be in any team with any other player.
Team Allocator
![Page 8: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/8.jpg)
Simple assessed exercise
You are given n players to be allocated to m teams (where n % m = 0). There are constraints of the form together(i,j) and apart(i,j) where • together(i,j) means that players i and j must be in the same team• apart(i,j) that players i and j must be in different teams.
By default, players can be in any team with any other player.
Team Allocator
12 4together 3 9together 5 9apart 2 8apart 6 8
![Page 9: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/9.jpg)
Simple assessed exercise
You are given n players to be allocated to m teams (where n % m = 0). There are constraints of the form together(i,j) and apart(i,j) where • together(i,j) means that players i and j must be in the same team• apart(i,j) that players i and j must be in different teams.
By default, players can be in any team with any other player.
Team Allocator
12 4together 3 9together 5 9apart 2 8apart 6 8
12 players split into 4 teams (each of 3 players)
![Page 10: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/10.jpg)
Simple assessed exercise
You are given n players to be allocated to m teams (where n % m = 0). There are constraints of the form together(i,j) and apart(i,j) where • together(i,j) means that players i and j must be in the same team• apart(i,j) that players i and j must be in different teams.
By default, players can be in any team with any other player.
Team Allocator
12 4together 3 9together 5 9apart 2 8apart 6 8
Players 3 and 9 in same teamPlayers 5 and 9 in same team
![Page 11: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/11.jpg)
Simple assessed exercise
You are given n players to be allocated to m teams (where n % m = 0). There are constraints of the form together(i,j) and apart(i,j) where • together(i,j) means that players i and j must be in the same team• apart(i,j) that players i and j must be in different teams.
By default, players can be in any team with any other player.
Team Allocator
12 4together 3 9together 5 9apart 2 8apart 6 8
Players 2 and 8 in different teamsPlayers 6 and 8 in different teams
![Page 12: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/12.jpg)
Simple assessed exercise
You are given n players to be allocated to m teams (where n % m = 0). There are constraints of the form together(i,j) and apart(i,j) where • together(i,j) means that players i and j must be in the same team• apart(i,j) that players i and j must be in different teams.
By default, players can be in any team with any other player.
Team Allocator
![Page 13: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/13.jpg)
They are given code
![Page 14: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/14.jpg)
They have to add code
![Page 15: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/15.jpg)
They are given problem instances
![Page 16: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/16.jpg)
An example: 40-8-02-00.txt
![Page 17: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/17.jpg)
• Create an array of constrained integer variables player[0] to player[11]• Each has a domain {1..4}, the teams they can be in• For apart(i,j) post constraint player[i] ≠ player[j]• For together(i,j) post constraint player[i] = player[j]• Use occurrence or cardinality constraint to ensure that each team occurs n/m times (i.e. number of players per team is satisfied)
Simple solution (and an instance)
Easy to get hands dirty
![Page 18: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/18.jpg)
• Create an array of constrained integer variables player[0] to player[11]• Each has a domain {1..4}, the teams they can be in• For apart(i,j) post constraint player[i] ≠ player[j]• For together(i,j) post constraint player[i] = player[j]• Use occurrence or cardinality constraint to ensure that each team occurs n/m times (i.e. number of players per team is satisfied)
Simple solution (and an instance)
Easy to get hands dirty
A variant o
f equita
ble graph colouring
![Page 19: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/19.jpg)
• Use a 0/1 model, 2D array, row for team, column for player• Use set variables, a set for each team• Pre-processing• Symmetry breaking• Variable ordering heuristics• We have hard instances (>12 hours to solve)• Devoted 1 lecture to discussing problem after deadline
Alternatives & richness
![Page 20: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/20.jpg)
Alternatives & richnessThe dark side of ex01
![Page 21: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/21.jpg)
Alternatives & richnessThe dark side of ex01
![Page 22: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/22.jpg)
![Page 23: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/23.jpg)
![Page 24: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/24.jpg)
![Page 25: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/25.jpg)
![Page 26: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/26.jpg)
![Page 27: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/27.jpg)
Google-proof?
• 20 animals escape from the zoo• We have 5 cages to put them in• Each cage can take at most 4 animals• The following animals cannot be in the same cage
• The rabbit and the fox• The spider and the fly• The worm and the robin• …
![Page 28: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/28.jpg)
Simple assessed exercise
It does take some effort to make an exercise
![Page 29: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/29.jpg)
conclusion
This went surprisingly well• I think they liked the problem• Generated a lot of discussion & interaction• I think they got the idea of CP and the problems we can solve
• Not just mashing up data
![Page 30: A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21](https://reader036.vdocuments.mx/reader036/viewer/2022070408/56649e6a5503460f94b67ee1/html5/thumbnails/30.jpg)
… with a little help from my friends