Car Sequencing Problem
-
Upload
ryan-franks -
Category
Documents
-
view
34 -
download
1
description
Transcript of Car Sequencing Problem
![Page 1: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/1.jpg)
Car Sequencing Problem
Assessed exercise 2
15%
27/11/09
![Page 2: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/2.jpg)
![Page 3: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/3.jpg)
![Page 4: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/4.jpg)
![Page 5: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/5.jpg)
![Page 6: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/6.jpg)
![Page 7: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/7.jpg)
![Page 8: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/8.jpg)
![Page 9: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/9.jpg)
![Page 10: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/10.jpg)
![Page 11: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/11.jpg)
![Page 12: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/12.jpg)
![Page 13: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/13.jpg)
![Page 14: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/14.jpg)
![Page 15: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/15.jpg)
![Page 16: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/16.jpg)
![Page 17: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/17.jpg)
![Page 18: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/18.jpg)
![Page 19: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/19.jpg)
![Page 20: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/20.jpg)
![Page 21: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/21.jpg)
representing the CSP as a csp
![Page 22: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/22.jpg)
Line 1: 10 cars, 5 options (sunRoof, airCon, elecWin, 2TonePaint, alloys) 6 classes (subsets of options)Line 2: Number of cars with an option allowed in a block (pi)Line 3: Size of block, measured as cars (qi)Line 4: class# #cars option1 (0/1) option2 (0/1) … option5 (0/1)…Line 9: class# #cars option1 (0/1) option2 (0/1) … option5 (0/1)
ii qlength ofblock ain carspmost at Produce/ ii qp
Also called r out of s in AIJ58
![Page 23: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/23.jpg)
]5][[]][5[][
]2][[]][2[][
]1][[]][1[][
icarOptionjoptionjicar
icarOptionjoptionjicar
icarOptionjoptionjicar
allDiff(cars)
Some thoughts/sketch
Need “sliding” p/q constraint on each rowconstrained integer variables
data read in (constants)
Find a time/position for each car
10
9
8
7
6
5
4
3
2
1
54321option\time
![Page 24: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/24.jpg)
]5][[]][5[][
]2][[]][2[][
]1][[]][1[][
icarOptionjoptionjicar
icarOptionjoptionjicar
icarOptionjoptionjicar
allDiff(cars)
Some thoughts/sketch
Decision variables?Need “sliding” p/q constraint on each row
Symmetries?
Heuristics?
Value ordering?
How does search proceed?
Bound v enumerated domains?
Find a time/position for each car
10
9
8
7
6
5
4
3
2
1
54321option\time
½ baked!
![Page 25: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/25.jpg)
Alternative model?
slots Time
Values for time slots are “classes” of cars
Constraints between time slots and the 2D array of 0/1 variablesrepresenting options over time
Occurrence constraints on classes
Due to AIJ58
What class of car do we make in a time slot/position?
10
9
8
7
6
5
4
3
2
1
54321option\time
![Page 26: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/26.jpg)
variablesAIJ , pages 139 to 151
c is number of classes of carsm is number of optionsn is number of cars to produce
opt[i][j] = 1 class i requires option j (read in as input)
SlotsArray of constrained integer variables S[n] S[i] {0..c-1} S[i] = j a car of class j is in slot i
OptionsArray of constrained 0/1 integer variables O[n][m] O[i][j] = 1 S[i] = x opt[x][j] = 1 O[i][j] = 0 S[i] = x opt[x][j] = 0 A car of class x is in slot i and requires option j alternatively option j produced at time i
![Page 27: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/27.jpg)
variables
Decision variables
c is number of classes of carsm is number of optionsn is number of cars to produce
opt[i][j] = 1 class i requires option j (read in as input)
SlotsArray of constrained integer variables S[n] S[i] {0..c-1} S[i] = j a car of class j is in slot i
OptionsArray of constrained 0/1 integer variables O[n][m] O[i][j] = 1 S[i] = x opt[x][j] = 1 O[i][j] = 0 S[i] = x opt[x][j] = 0 A car of class x is in slot i and requires option j alternatively option j produced at time i
![Page 28: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/28.jpg)
variables
c = 6m = 5n = 10
5
S
9
8
7
6
5
4
000113
2
1
0
43210O
![Page 29: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/29.jpg)
constraintsDemand constraint
d[i] is demand (number of cars) for class iFor all i: occurrence of i in S is d[i]
![Page 30: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/30.jpg)
spelling!
![Page 31: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/31.jpg)
![Page 32: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/32.jpg)
constraintsCapacity, p/q, constraint
p[j] is the number of cars with option j that can beproduced in a block of length q[j]
O[0][j] + … + O[q[j]-1][j] ≤ p[i]O[1][j] + … + O[q[j]][j] ≤ p[i]...More generallyO[i][j] +…+ O[i+q[j]-1][j] ≤ p[i] 1 ≤ i ≤ n-q[j]+1
Uses constraints sum and leq
Do this for all options j
r outof s in AIJ58
![Page 33: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/33.jpg)
constraintsThe link constraint (page 144)
If a car of class j is being produced in time slot i and that class of car requires an option xthen option x is required in time i
S[i] = 2 O[i][0] = 0 O[i][1] = 1 O[i][2] = 0 O[i][3] = 0 O[i][4] = 1
Do this for all times/positions 0 ≤ i < n and all classes 0 ≤ j < c
![Page 34: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/34.jpg)
If a car of class j is being produced in time slot i and that class of car requires an option xthen option x is required in time i
constraintsThe link constraint
S[i] {0,4,5} O[i][0] = 1 S[i] {2,3,5} O[i][1] = 1S[i] {0,4} O[i][2] = 1S[i] {0,1,3} O[i][3] = 1S[i] {2} O[i][4] = 1
Do this for all time slots and all options
This maintains arc-consistency
Turn it around by 90 degrees
This gets more propagation
![Page 35: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/35.jpg)
constraintsThe link constraint
Are these the same i.e. logically and wrt propagation?
S[i] {0,4} O[i][2] = 1
S[i] = 0 S[i] = 4 O[i][2] = 1
S[i] ≠ 1 S[i] ≠ 2 S[i] ≠ 3 O[i][2] = 1
S[i] {0,4,5} O[i][0] = 1 S[i] {2,3,5} O[i][1] = 1S[i] {0,4} O[i][2] = 1S[i] {0,1,3} O[i][3] = 1S[i] {2} O[i][4] = 1
S[i] ≠ 0 S[i] ≠ 4 O[i][2] = 0
I wonder if this oneproduces most propagation
![Page 36: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/36.jpg)
constraintsThe redundant constraint (page 146)
Let d[i] be the demand for option i
Example: d[3] = 1 + 1 + 0 + 2.1 + 0 + 0 = 4 p[3]/q[3] = 2/5
O[0][3] + O[1][3] + O[2][3] + O[3][3] + O[4][3] ≥ d[3] – 2
Another example
options
demand
The ReasoningThe demand for option 3 is 4 cars (d[3] = 4). In the last 5 slots we can make at most 2 cars with this optionConsequently in the previous 5 slots we MUST make at least 2 cars
![Page 37: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/37.jpg)
constraintsThe redundant constraint
Example: d[0] = 1 + 0 + 0 + 0 + 2 + 2 = 5 p[0]/q[0] = 1/2
O[0][0] + + O[7][0] ≥ d[0] – 1 O[0][0] + + O[5][0] ≥ d[0] – 2 O[0][0] + + O[3][0] ≥ d[0] – 3 O[0][0] + O[1][0] ≥ d[0] – 4
This constraint makes a BIG difference
![Page 38: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/38.jpg)
heuristicsVariable ordering
What are the decision variables?Dynamic Variable Ordering: sdf?
AIJ58 Page 146 to 150
![Page 39: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/39.jpg)
This slide intentionally left blank
![Page 40: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/40.jpg)
heuristicsValue ordering
What is value ordering in this context?
![Page 41: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/41.jpg)
heuristicsValue ordering
Having selected a vacant slot to consider,what class of car should we place in that slot?
Suggestions?
![Page 42: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/42.jpg)
Software reuseHave a look at CSPCertificate
Could this be used to produce a loader?
How do you know your solutio
n is correct?
![Page 43: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/43.jpg)
My code
![Page 44: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/44.jpg)
![Page 45: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/45.jpg)
So?
Encode a model for car sequencing problem using toolkit primitives
Incorporate “redundant” constraint identified by PvHUse heuristics of your choiceCertify your solutionsPerform small empirical study
![Page 46: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/46.jpg)
and …
Write a short report, no more than 2 pagesdescribing your models and how they go
Email me this along with code that I can run and verifyMake sure you give instructions on how to runMake sure output is verifiable (standard)
![Page 47: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/47.jpg)
![Page 48: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/48.jpg)
![Page 49: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/49.jpg)
![Page 50: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/50.jpg)
![Page 51: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/51.jpg)
![Page 52: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/52.jpg)
![Page 53: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/53.jpg)
![Page 54: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/54.jpg)
![Page 55: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/55.jpg)
![Page 56: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/56.jpg)
![Page 57: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/57.jpg)
You must read this
![Page 58: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/58.jpg)
![Page 59: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/59.jpg)
![Page 60: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/60.jpg)
![Page 61: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/61.jpg)
And so on ….
You should read PvH’s paper
![Page 62: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/62.jpg)
![Page 63: Car Sequencing Problem](https://reader035.fdocuments.us/reader035/viewer/2022062516/56812ac2550346895d8e8cf6/html5/thumbnails/63.jpg)
Looking at both sides
Interchanging variables with values
- to make things all different? - a permutation?