Car Sequencing Problem Assessed exercise 2 15% 26/11/2010.

Slides:



Advertisements
Similar presentations
1D Bin Packing (or “CP? Who cares?”)
Advertisements

Maximal Independent Sets of a Hypergraph IJCAI01.
Car Sequencing Problem An update. How to certify output Standard output The Certificate class.
The Functions and Purposes of Translators Code Generation (Intermediate Code, Optimisation, Final Code), Linkers & Loaders.
But Shaun’s already proved P equals NP. Can’t we move onto quantified SAT? Woof!
Bowen Yu Programming Practice Midterm, 7/30/2013.
CPSC 322, Lecture 13Slide 1 CSPs: Arc Consistency & Domain Splitting Computer Science cpsc322, Lecture 13 (Textbook Chpt 4.5,4.6) February, 01, 2010.
CPSC 411, Fall 2008: Set 4 1 CPSC 411 Design and Analysis of Algorithms Set 4: Greedy Algorithms Prof. Jennifer Welch Fall 2008.
Constraint Satisfaction Problems
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 OpenMP -Example ICS 535 Design and Implementation.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 10.
Modeling the Covering Test Problem Brahim Hnich, Steven Prestwich, and Evgeny Selensky Cork Constraint Computation Center UCC Supported by SFI.
Chair of Software Engineering 1 Introduction to Programming Exercise Session Week 10 M. Piccioni 24/25 November 2008.
Machine-Independent Optimizations Ⅰ CS308 Compiler Theory1.
Data Flow Analysis Compiler Design Nov. 8, 2005.
Cardinality & Sorting Networks. Cardinality constraint Appears in many practical problems: scheduling, timetabling etc’. Also takes place in the Max-Sat.
Adapted from slides by Marie desJardins
1 1.1 © 2012 Pearson Education, Inc. Linear Equations in Linear Algebra SYSTEMS OF LINEAR EQUATIONS.
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
Review for Midterm Chapter 1-9 CSc 212 Data Structures.
Slide 1 CSPs: Arc Consistency & Domain Splitting Jim Little UBC CS 322 – Search 7 October 1, 2014 Textbook §
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21.
Specialised (user defined) constraints in JChoco 2 examples: max and subtour elimination.
Jobshop scheduling. We have a set of resources a set of jobs a job is a sequence of operations/activities sequence the activities on the resources.
Analysis of Algorithms These slides are a modified version of the slides used by Prof. Eltabakh in his offering of CS2223 in D term 2013.
Modelling for Constraint Programming Barbara Smith CP 2010 Doctoral Programme.
Practice and Evaluation. Practice Develop a java class called: SumCalculator.java which computes a sum of all integer from 1 to 100 and displays the result.
Computer Science CPSC 322 Lecture 13 Arc Consistency (4.5, 4.6 ) Slide 1.
CP Summer School Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Cs413_design04.ppt Design and Software Development Design : to create a functional interface that has high usability Development : an organized approach.
Exact and heuristics algorithms
Presented By Dr. Mohsen Alardhi College of Technological Studies, Kuwait April 19 th,2009.
Computer Programming for Biologists Class 6 Nov 21 th, 2014 Karsten Hokamp
Chapter 5 Constraint Satisfaction Problems
CP Summer School Modelling for Constraint Programming Barbara Smith 3. Symmetry, Viewpoints.
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
Computer Science Background for Biologists CSC 487/687 Computing for Bioinformatics Fall 2005.
1 Writing Software Kashef Mughal. 2 Algorithms  The term algorithm (pronounced AL-go-rith-um) is a procedure or formula for solving a problem.  An Algorithm.
Lecture 9COMPSCI.220.FS.T Lower Bound for Sorting Complexity Each algorithm that sorts by comparing only pairs of elements must use at least 
8puzzle in CP initial state goal state A trivial example.
Adding & Subtracting Polynomials. What is a Polynomial? View this Cool Math lesson introducing Polynomials.Cool Math lesson There is only the 1 page of.
State space search Represented by a four-tuple [N,A,S,GD], where: N is the problem space A is the set of arcs (or links) between nodes. These correspond.
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Lecture 16  Last time Searching a Graphplan for a plan, and relaxed plan heuristics.
2-105 C B A. Instructions: Read and follow instructions. The “dynamic geometry tool” you need can be linked to from my Geometry page (2.3.2). Make.
CS 171: Intro to AI Discussion Week 2 Jan 15 th 2016.
An Introduction to Constraint Programming in JChoco.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Jobshop scheduling.
Hard Problems Some problems are hard to solve.
Monster (“Mega”) Sudoku
Courtsey & Copyright: DESIGN AND ANALYSIS OF ALGORITHMS Courtsey & Copyright:
13 Text Processing Hongfei Yan June 1, 2016.
Paul Ammann & Jeff Offutt
Problem Solving: Brute Force Approaches
Using WinQSB to solve Linear Programming Models
Number partitioning.
NP-Complete Problems.
Turn in your Homework to the box before the tardy bell rings.
8puzzle in CP.
Class 4: Repetition Pretest Posttest Counting Flowchart these!
Artificial Intelligence
P.O.D. # 32 2/4/19.
Developing a Program.
Discrete Mathematics 7th edition, 2009
Presentation transcript:

Car Sequencing Problem Assessed exercise 2 15% 26/11/2010

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 ) Line 3: Size of block, measured as cars (q i ) 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

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

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 ½ baked!

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 What class of car do we make in a time slot/position?

variablesAIJ, pages 139 to 151 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

variables Decision 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

variables c = 6 m = 5 n = 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]

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

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

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 constraints 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 Do this for all time slots and all options This maintains arc-consistency Turn it around by 90 degrees This gets more propagation

constraints The 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] = 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 S[i] ≠ 0  S[i] ≠ 4  O[i][2] = 0 I wonder if this one produces most propagation

constraintsThe redundant constraint (page 146) Let d[i] be the demand for option i Example: d[3] = = 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 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

constraints The redundant constraint Example: d[0] = = 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

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

This slide intentionally left blank

heuristics Value ordering What is value ordering in this context?

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

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

My code

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

and … Write a short report, no more than 2 pages describing your models and how they go 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)

You must read this

And so on …. You should read PvH’s paper

Looking at both sides Interchanging variables with values - to make things all different? - a permutation?