1 / 63

Car Sequencing Problem

Car Sequencing Problem. Assessed exercise 2 15% 27/11/09. representing the CSP as a csp. 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 (p i )

ryan-franks
Download Presentation

Car Sequencing Problem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Car Sequencing Problem Assessed exercise 2 15% 27/11/09

  2. representing the CSP as a csp

  3. 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) Also called r out of s in AIJ58

  4. Find a time/position for each car Some thoughts/sketch allDiff(cars) data read in (constants) constrained integer variables Need “sliding” p/q constraint on each row

  5. Find a time/position for each car Some thoughts/sketch Heuristics? ½ baked! Bound v enumerated domains? Value ordering? allDiff(cars) How does search proceed? Symmetries? Decision variables? Need “sliding” p/q constraint on each row

  6. What class of car do we make in a time slot/position? Alternative model? Values for time slots are “classes” of cars Constraints between time slots and the 2D array of 0/1 variables representing options over time Occurrence constraints on classes Due to AIJ58

  7. AIJ , pages 139 to 151 variables c is number of classes of cars m is number of options n is number of cars to produce opt[i][j] = 1  class i requires option j (read in as input) Slots Array of constrained integer variables S[n] S[i]  {0..c-1} S[i] = j  a car of class j is in slot i Options Array 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

  8. variables c is number of classes of cars m is number of options n is number of cars to produce opt[i][j] = 1  class i requires option j (read in as input) Slots Array of constrained integer variables S[n] S[i]  {0..c-1} S[i] = j  a car of class j is in slot i Options Array 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 Decision variables

  9. variables c = 6 m = 5 n = 10

  10. constraints Demand constraint d[i] is demand (number of cars) for class i For all i: occurrence of i in S is d[i]

  11. spelling!

  12. constraints Capacity, p/q, constraint p[j] is the number of cars with option j that can be produced 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 generally O[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

  13. constraints The 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 x then 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

  14. constraints The link constraint If a car of class j is being produced in time slot i and that class of car requires an option x then option x is required in time i Turn it around by 90 degrees S[i]  {0,4,5}  O[i][0] = 1 S[i]  {2,3,5}  O[i][1] = 1 S[i]  {0,4}  O[i][2] = 1 S[i]  {0,1,3}  O[i][3] = 1 S[i]  {2}  O[i][4] = 1 Do this for all time slots and all options This gets more propagation This maintains arc-consistency

  15. constraints I wonder if this one produces most propagation The link constraint S[i]  {0,4,5}  O[i][0] = 1 S[i]  {2,3,5}  O[i][1] = 1 S[i]  {0,4}  O[i][2] = 1 S[i]  {0,1,3}  O[i][3] = 1 S[i]  {2}  O[i][4] = 1 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  S[i] ≠ 4  O[i][2] = 0

  16. The redundant constraint (page 146) constraints Another example options 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 demand The Reasoning The demand for option 3 is 4 cars (d[3] = 4). In the last 5 slots we can make at most 2 cars with this option Consequently in the previous 5 slots we MUST make at least 2 cars • O[0][3] + O[1][3] + O[2][3] + O[3][3] + O[4][3] ≥ d[3] – 2

  17. constraints The 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

  18. heuristics Variable ordering What are the decision variables? Dynamic Variable Ordering: sdf? AIJ58 Page 146 to 150

  19. This slide intentionally left blank

  20. heuristics Value ordering What is value ordering in this context?

  21. heuristics Value ordering Having selected a vacant slot to consider, what class of car should we place in that slot? Suggestions?

  22. Software reuse Have a look at CSPCertificate Could this be used to produce a loader? How do you know your solution is correct?

  23. My code

  24. So? Encode a model for car sequencing problem using toolkit primitives Incorporate “redundant” constraint identified by PvH Use heuristics of your choice Certify your solutions Perform small empirical study

  25. and … Write a short report, no more than 2 pages describing your models and how they go Email me this along with code that I can run and verify Make sure you give instructions on how to run Make sure output is verifiable (standard)

More Related