CSC5240 Combinatorial Search and Optimization with Constraints Tutorial Notes 7
CSC5240 Tutorial 7 Global Constraints in ILOG Paper Presentation Project Proposal
Global Constraints Often-seen sub-problems (complex constraints) in modeling with specific AC-revise() procedure ILOG provides a number of global constraints : IloAllDiff IloDistribute IloSequence IloAllMinDistance IloPartition IloAllNullIntersect IloEqUnion …
IloAllDiff Restrict each value to appear at most once among the variables. 1 2 3
IloAllDiff Restrict each value to appear at most once among the variables. 3 2 3
IloDistribute Often called “cardinality constraints” or “global cardinality constraints” (gcc) Used to restrict the number of occurrences of each value among the variables. Special Case: AllDiff constraint The number of occurrences of each value is 1
IloDistribute How about restricting each value to appear within a range of number of times? E.g. Given variables x, y, z D(x) = D(y) = D(z) = {1,2,3} Among x, y, z, we want to have - value 1 to appear [1,2] times - value 2 to appear [0,1] times - value 3 to appear [0,3] times Is the following assignment correct? 1 1 2
IloDistribute E.g. Given variables x, y, z D(x) = D(y) = D(z) = {1,2,3} Among x, y, z, we want to have - value 1 to appear [1,2] times - value 2 to appear [0,1] times - value 3 to appear [0,3] times Is the following assignment correct? 3 3 3
IloDistribute IloDistribute is used to count the number of variables that takes a given value in an array. cards – An array storing the occurrence range for each value [1..2], [3..4], [0..5] values – an array of values vars – an array storing the variables IloDistribute(IloEnv env, IloIntVarArray cards, IloNumArray values, IloNumVarArray vars); 1 2 3
IloDistribute The arrays cards and values must be of the same length. For each i, cards[i] is equal to the number of occurrences of values[i] in the array vars. IloDistribute(IloEnv env, IloIntVarArray cards, IloNumArray values, IloNumVarArray vars);
IloDistribute e.g. the value stored in values[2] should occur in the array vars 3 to 5 times. cards[2] = IloIntVar(env, 3, 5); e.g. the value stored in values[3] should occur in the array vars at most twice. cards[3] = IloIntVar(env, 0, 2); IloDistribute(IloEnv env, IloIntVarArray cards, IloNumArray values, IloNumVarArray vars);
Example: BIBD Recall the BIBD problem in Tutorial 1, Assignment 1/2. Incidence matrix: A v by b binary matrix Exactly r ones per row Exactly k ones per column A scalar product of lambda between any pair of distinct rows
Model Use IloDistribute !
Using global constraints However, if you just post those global constraints, ILOG may not call their specific AC-revise() methods E.g. ILOG will use a set of disequalities to replace IloAllDiff() If you really have to enforce hyper-arc consistency on those global constraints, set the filter level to the extended level ... model.add(IloAllDiff(env, x)); solver.setDefaultFilterLevel(IloAllDiffCt, IloExtendedLevel);
Demonstration Click here to open the code!
Presentation Communicate key ideas Don’t get bogged down in details Use a top-down approach Introduction Body Technicalities Conclusion
Top-down Approach Introduction Body Motivate the audience Define the problem Discuss earlier work Emphasize the contributions Body Delineate major results Explain the significance of the results
Top-down Approach Technicalities Conclusion Present the key theorem / result / overview of the implementation Show and explain the experimental results, if any Try to be as succinct and clear as possible Conclusion Weave earlier statements into a coherent synopsis State open problems Indicate that your talk is over
Some Guidelines Remind, don’t assume Don’t over-run Maintain eye contact, control your voice and motion Don’t overload a single slide with too much information Use colours and fonts effectively Use pictures, tables, and examples Prefer words over symbols, and pictures over words
Questions and Answers Prepare additional slides to anticipate questions on confusing technicalities Some questions are intended to see how you react to criticism under pressure Be prepared, be polite, avoid getting involved in a lengthy exchange Don’t confuse “I don’t know” with “it is not known”
Several deadlines Assignment 2 deadline: 10 Nov., 2009 Paper presentation: 19 Nov., 2009 (Lecture time) 21 Nov., 2009 (Saturday morning) You have to email your project proposal with 2 - 4 pages to Jimmy on or before 20 Nov. (Friday) Project Presentation: 18 Dec., 2009
END