740 likes | 938 Views
Case study 5: balanced academic curriculum problem. Joint work with Brahim Hnich and Zeynep Kiziltan (CPAIOR 2002). Outline. Introduction Balanced Academic Curriculum Problem (BACP) Alternate Models Combined Models Experimental Results Conclusions. Introduction.
E N D
Case study 5: balanced academic curriculum problem Joint work with Brahim Hnich and Zeynep Kiziltan (CPAIOR 2002)
Outline • Introduction • Balanced Academic Curriculum Problem (BACP) • Alternate Models • Combined Models • Experimental Results • Conclusions
Introduction • Modelling optimisation problems as CSPs requires many skills • Quite often alternate models are tried • models that add implied constraints • models that add symmetry-breaking constraints • models that use different variable representation • models that use different constraint formulation • combined models • solved with the same solution method • solved with different solution methods
Recipe • Create a basic model • Decide on the variables • Introduce auxiliary variables • For messy/loose constraints • Consider dual, combined or 0/1 models • Break symmetry • Add implied constraints • Customize solver • Variable, value ordering
BACP: description • Each course has associated a numberof credits • some courses can have other courses as prerequisite • a minimum amount of credits per period is required • a maximum amount of credits per period is allowed • a minimum number of courses per period is required • a maximum number of courses per period is allowed Periods 1 2 3 4 1 2 3 4 Courses 5 6 7 8
BACP: objective • Assign a period to every course such that the following constraints are satisfied: • the minimum and maximum academic load for each period • the minimum and maximum number of courses for each period • the prerequisite relationships • An optimal balanced curriculum minimises the maximum academic load for all periods
Periods Cur1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 Courses 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 Model 1: variables
Model 1: constraints • Each course is taught jperiods Cur1[i,j] = 1 • Min and max courses per period c icourses Cur1[i,j] d
Model 1: constraints • Each course is taught jperiods Cur1[i,j] = 1 • Min and max courses per period c icourses Cur1[i,j] d • Academic load in each period more messy • Each course comes with a weight • Is there a way of dealing with this constraint efficiently?
Recipe • Create a basic model • Decide on the variables • Introduce auxiliary variables • For messy/loose constraints • Consider dual, combined or 0/1 models • Break symmetry • Add implied constraints • Customize solver • Variable, value ordering
Refine Model 1: auxiliary vars • Add auxiliary variables to compute academic load in each period Load(j) = icourses credit(i)*Cur1[i,j]
Load 0..maxint 0..maxint 0..maxint 0..maxint Periods Cur1 0..1 0..1 0..1 0..1 =1 0..1 0..1 0..1 0..1 . . . . . 0..1 0..1 0..1 0..1 Courses 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 =1 Periods Model 1: variables
Good News: all constraints are linear: we can also employ ILP methods Bad News: prerequisite constraints: too many constraints high arity-constraints We refer to model 1 as CP1 when CP solver is used and ILP when ILP solver is used Model 1: constraints Objective function: minimize max(Load) Computing load of period j: Load(j) = icourses credit(i)*Cur1[i,j] Restricting the load of period j: a Load(j) b Restricting the number of courses of period j: c icourses Cur1[i,j] d Prerequisite constraints btw i and j: k-1 kperiods: k> 1 Cur1[j,k] r=1 Cur1[i,r]
Breaking symmetry • Shouldn’t we be worrying about breaking symmetry?
Breaking symmetry • Shouldn’t we be worrying about breaking symmetry? • Not really • Time periods are not usually symmetrical due to pre-requisites • Similarly courses are only symmetrical if they carry the same load and pre-requisites
Alternative models? • Model 1 has lots of 0/1 variables • Can’t we exploit larger domains that CSPs give us?
Load 0..maxint 0..maxint 0..maxint 0..maxint Periods Model 2: variables courses Cur2 in periods in periods in periods in periods in periods
Good News: use of global constraints efficient statement of prerequisite constraints Bad News: load computation: more Boolean variables more reification constraints We refer to model 2 as CP2 Model 2: constraints Objective function: minimize max(Load) Computing load of period j: Load(j) = icourses credit(i)*B i,j B i,j Cur2[i]=j, for all i Restricting the load of period j: a Load(j) b Restricting the number of courses of period j: atleast(j, Cur2,c) atmost(j,Cur2,d) Prerequisite constraint btw i and j: Cur2[i] < Cur2[j]
Model CP1 vs. Model CP2 • CP2 • Good News: • use of global constraints to restriction number of courses • statement of prerequisite constraints • Bad News: • statement of academic load constraint • CP1 • Good News: • academic load constraint easily stated by a weighted column sum • Bad News: • statement of prerequisite constraints
Combined model CP1+CP2 Cur1[i,j]=1 Cur2[i]=j • CP2 • Good News: • use of global constraints to restriction number of courses • statement of prerequisite constraints • Bad News: • statement of academic load constraint • CP1 • Good News: • academic load constraint easily stated by a weighted column sum • Bad News: • statement of prerequisite constraints Bad News - Channelling constraints - Increased number of variables
Model ILP vs Model CP2 • CP2 • Good News: • use of global constraints to restriction number of courses • statement of prerequisite constraints • Bad News: • statement of academic load constraint • ILP • Good News: • academic load constraint easily stated by a weighted column sum • all constraints are linear • Bad News: • statement of prerequisite constraints
Hybrid model ILP+CP2 Cur1[i,j]=1 Cur2[i]=j • CP2 • Good News: • statement of prerequisite constraints • ILP • Good News: • academic load constraint easily stated by a weighted column sum • all constraints are linear • Bad News: • statement of prerequisite constraints Bad News - Channelling constraints - Increased number of variables
Finding optimal solution • We used three real-life instances • CP1+CP2 is the quickest • due to the increase in the amount of pruning that compensated the increase in variables and constraints • ILP+CP2 is second best model • better than CP2 in all instance • better than ILP in two instances • CP model is essential in reducing the search space while the ILP model with its relaxation is essential for bounding and guiding the search
Proving optimality • Proving Optimality • ILP+CP2 is quicker than ILP on two instances, and is the quickest on these instances • ILP+CP2 benefits from CP model in reducing the search space, and from the relaxation of the ILP model • It is tough for all CP models (CP1, CP2, CP1+CP2) to prove optimality
Yet other alternate models Viewing BACP as a set partitioning problem • the set of courses ought to be partitioned into n subsets, one for each periods • n set variables that are subsets of the set of courses • the union of all set variables is the set of courses • all set variables must be pair-wise disjoint • all constraints of BACP can easily be stated using weighted cardinality, and cardinality constraints • except, the prerequisite constraints! • To enhance the model based on set variables, we can also channel into the model CP2
Conclusions • Lesson 1: When constraints are difficult to specify in a particular model, we should consider channelling into a second model in which these constraints are easier to specify and reason about • Lesson 2: • CP models may excel in finding optimal or near-optimal solutions • ILP models may be better for proving optimality
Conclusions • Lesson 3: CP and ILP tools should provide efficient primitives for channelling between models • Lesson 4: careful integration of different models can result in better models despite the increase in the number of variables and constraints
Case study 6: Steel Mill Slab Design Problem Joint work with Alan Frisch and Ian Miguel
Overview • The slab design problem • An example • Model A • Model B • A dual model A/B • Results • Conclusion/Future Work
Background • This work is based on the problem as stated in: • “Variable Sized Bin Packing with Color Constraints”, Dawande, Kalagnanam and Sethuraman 1998. • Approximation algorithms guaranteed to be within some bound of an optimal solution.
Motivation • Many problems exhibit flexibility in portions of their structure. • Example: the number required of a certain type of variable. • Flexibility must be resolved during the solution process. • Slab design is a representative example of this type of problem.
The Slab Design Problem • The mill can make different slab sizes. • Given j input orders with: • A colour (route through the mill). • A weight. • Pack orders onto slabs such that the total slab capacity is minimised, subject to: • Capacity constraints. • Colour constraints.
Slab Design Constraints • Capacity: • Total weight of orders assigned to a slab cannot exceed slab capacity. • Colour: • Each slab can contain at most p of k total colours. • Reason: expensive to cut slabs up to send them to different parts of the mill.
An Example • Slab Sizes: {1, 3, 4} ( = 3) • Orders: {oa, …, oi} (j = 9) • Colours: {red, green, blue, orange, brown} (k = 5) • p = 2 3 2 2 1 1 1 1 1 1 a b c d e f g h i
An Example Solution • 6 Slabs: 2 h 3 1 e 2 1 b f a 1 1 1 1 g c d i (size 4) (size 3) (size 3) (size 1) (size 1) (size 1)
Recipe • Create a basic model • Decide on the variables • Introduce auxiliary variables • For messy/loose constraints • Consider dual, combined or 0/1 models • Break symmetry • Add implied constraints • Customize solver • Variable, value ordering
Basic model • What are the variables? • Need to assign sizes to slabs • Complicated because we don’t even know how many slabs will be used
Model A – Redundant Variables • Slabs cannot be more than orders • Assuming greatest order weight does not exceed maximum slab size • A list, S, of slab variables: {s1, …, sj}. • Domains size . • Solution quality:
Slab Variable Redundancy • Some slab variables may be redundant: • 0 is added to the domain of each si. • If si is not necessary to solve the problem, si = 0.
Slab Variable Symmetry • Slab variables are indistinguishable. • So model A suffers from symmetry: • Counteract with binary symmetry-breaking constraints: s1s2, s2s3, etc.
Basic model • What are the variables? • Need to assign orders to slabs • Want to compute weight on each slab efficiently
More Slab Symmetry • Slab variables assigned the same size are indistinguishable • If si and si+1 have the same size, the corresponding rows of the order matrix are lexicographically ordered. • E.g. 1001 0110.
Colour constraints • Need to count how many colours used on a slab • Counting hard • Channel into a matrix of 0/1 variables and sum rows
Colour Matrix: colourMa Channelling:
Model A of the Example Problem 3 2 2 1 1 1 1 1 1 oa ob oc od oe of og oh oi
A Solution: Model A 3 2 2 1 1 1 1 1 1 oa ob oc od oe of og oh oi s1 = 4, s2 = 3, s3 = 3, s4 = 3, si = 0 (5 i 9)
Recipe • Create a basic model • Decide on the variables • Introduce auxiliary variables • For messy/loose constraints • Consider dual, combined or 0/1 models • Break symmetry • Add implied constraints • Customize solver • Variable, value ordering
Model A Implied Constraints • Combined weight of input orders is a lower bound on optimisation variable: • Lower bound on number of slabs required: • With symmetry-breaking constraints, decomposes • into unary constraints on slab variables.
Model A Implied Constraints (2) • AssWti is the weight of orders assigned to si. • Prune domains by reasoning about reachable values via dynamic programming [Trick, 2001]. • Incorporate both size and colour information. • More powerful if done during search (future work). • Minimum number of slabs required: