Modelling for Constraint Programming

Similar documents
The core of solving constraint problems using Constraint Programming (CP), with emphasis on:

Solving the Kirkman s Schoolgirl Problem in a Few Seconds

Symmetry Breaking Ordering Constraints

Symmetry Breaking using Value Precedence

Math 381 Midterm Practice Problem Solutions

Boosting Set Constraint Propagation for Network Design

Symmetry Breaking in Graceful Graphs

Computational Integer Programming. Lecture 2: Modeling and Formulation. Dr. Ted Ralphs

Symmetry. Pierre Flener. ACP Summer School Aussois (France), 5 and 6 May ASTRA Research Group on CP Uppsala University Sweden

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

AUTOMATED REASONING. Agostino Dovier. Udine, October 2, Università di Udine CLPLAB

Constraint Programming and Graph Algorithms

Alternative Methods for Obtaining. Optimization Bounds. AFOSR Program Review, April Carnegie Mellon University. Grant FA

Automatic Generation of Redundant Models for Permutation Constraint Satisfaction Problems

Breaking Value Symmetries in Matrix Models using Channeling Constraints

Matroids. Start with a set of objects, for example: E={ 1, 2, 3, 4, 5 }

Static and Dynamic Structural Symmetry Breaking

Projection, Inference, and Consistency

Combinatorial optimization problems

Section Notes 8. Integer Programming II. Applied Math 121. Week of April 5, expand your knowledge of big M s and logical constraints.

Disjoint, Partition and Intersection Constraints for Set and Multiset Variables

Interleaved Alldifferent Constraints: CSP vs. SAT Approaches

19. Fixed costs and variable bounds

System of Linear Equations. Slide for MA1203 Business Mathematics II Week 1 & 2

19. Logic constraints, integer variables

Dynamic Symmetry Breaking Constraints

Symmetry Definitions for Constraint Satisfaction Problems

The Challenge of Generating Spatially Balanced Scientific Experiment Designs?

21. Set cover and TSP

CS Algorithms and Complexity

5x 2 = 10. x 1 + 7(2) = 4. x 1 3x 2 = 4. 3x 1 + 9x 2 = 8

Decision Diagrams for Discrete Optimization

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

Linear Programming Duality

Practical Tips for Modelling Lot-Sizing and Scheduling Problems. Waldemar Kaczmarczyk

Math 308 Midterm Answers and Comments July 18, Part A. Short answer questions

What is an integer program? Modelling with Integer Variables. Mixed Integer Program. Let us start with a linear program: max cx s.t.

Math 1070 Exam 2. March 16, 2006

Deterministic Operations Research, ME 366Q and ORI 391 Chapter 2: Homework #2 Solutions

Discrete (and Continuous) Optimization Solutions of Exercises 2 WI4 131

Disconnecting Networks via Node Deletions

Math 1070 Exam 2. March 16, 2006

Economics 201b Spring 2010 Solutions to Problem Set 1 John Zhu

Recursion: Introduction and Correctness

A Global Constraint for Parallelizing the Execution of Task Sets in Non-Preemptive Scheduling

1 Algebraic Methods. 1.1 Gröbner Bases Applied to SAT

Preprocessing. Complements of Operations Research. Giovanni Righini. Università degli Studi di Milano

The matrix approach for abstract argumentation frameworks

Computational Integer Programming Universidad de los Andes. Lecture 1. Dr. Ted Ralphs

Week 4. (1) 0 f ij u ij.

Math 378 Spring 2011 Assignment 4 Solutions

in specific rooms. An objective is to minimise the geographical distance between the allocated rooms and the requested rooms of the events. A highly p

Algorithms and Data Structures 2016 Week 5 solutions (Tues 9th - Fri 12th February)

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

CIS 2033 Lecture 5, Fall

Counting Strategies: Inclusion/Exclusion, Categories

Minilecture 2: Sorting Algorithms

Consistency algorithms. Chapter 3

Chapter 3: Discrete Optimization Integer Programming

Math 1314 Week #14 Notes

Relations on Hypergraphs

Propagation Algorithms for Lexicographic Ordering Constraints

Octagonal Domains for Continuous Constraints

Counting Strategies: Inclusion/Exclusion, Categories

Spring 2018 IE 102. Operations Research and Mathematical Programming Part 2

Unit 1. Thinking with Mathematical Models Investigation 1: Exploring Data Patterns

Logic, Optimization and Data Analytics

Exploiting symmetries within constraint satisfaction search

Definition 2.3. We define addition and multiplication of matrices as follows.

Distributed Optimization. Song Chong EE, KAIST

Foundations of Computer Science Lecture 14 Advanced Counting

Theory of Computation Chapter 1: Introduction

4-8 Quadratic Inequalities. Graph each inequality. ANSWER: ANSWER: ANSWER: CCSS SENSE-MAKING Solve each inequality by graphing.

Breaking Local Symmetries in Quasigroup Completion Problems

Computing Neural Network Gradients

Search and Lookahead. Bernhard Nebel, Julien Hué, and Stefan Wölfl. June 4/6, 2012

Organization Team Team ID#

What we will try to do...

Room Allocation Optimisation at the Technical University of Denmark

Solving LP and MIP Models with Piecewise Linear Objective Functions

LINEAR ALGEBRA W W L CHEN


Column Generation. i = 1,, 255;

Week 3: Reductions and Completeness

SAT, CSP, and proofs. Ofer Strichman Technion, Haifa. Tutorial HVC 13

Discrete (and Continuous) Optimization WI4 131

A Pigeon-Hole Based Encoding of Cardinality Constraints

Graph Coloring Inequalities from All-different Systems

3.4 Relaxations and bounds

Gestion de la production. Book: Linear Programming, Vasek Chvatal, McGill University, W.H. Freeman and Company, New York, USA

Trees/Intro to counting

a (b + c) = a b + a c

Determinants in detail

ACO Comprehensive Exam October 18 and 19, Analysis of Algorithms

Learning to Branch. Ellen Vitercik. Joint work with Nina Balcan, Travis Dick, and Tuomas Sandholm. Published in ICML 2018

is called an integer programming (IP) problem. model is called a mixed integer programming (MIP)

Small Label Classes in 2-Distinguishing Labelings

Symmetries in CSP. Symmetries in CSP. Elena Sherman UNL, CSE. April 18, 2009

Basic Combinatorics. Math 40210, Section 01 Fall Homework 8 Solutions

CSE 421 Greedy Algorithms / Interval Scheduling

Transcription:

Modelling for Constraint Programming Barbara Smith 3. Symmetry, Viewpoints

Symmetry in CSPs A symmetry transforms any solution into another Sometimes symmetry is inherent in the problem (e.g. chessboard symmetry in n-queens) Sometimes it s introduced in modelling Symmetry causes wasted search effort: after exploring choices that don t lead to a solution, symmetrically equivalent choices may be explored CP Summer School September 2005 3/2

Example: SONET Rings Split the demand graph into subgraphs (SONET rings): every edge is in at least one subgraph a subgraph has at most 5 nodes minimize total number of nodes in the subgraphs Modelled using Boolean variables, x ij, such that x ij = 1 if node i is on ring j Introduces symmetry between the rings in the problem, the rings are interchangeable CP Summer School September 2005 3/3

Symmetry between Values: Car sequencing A natural model has individual cars as the values introduces symmetry between cars requiring the same option The model instead has classes of car needs constraints to ensure the right number of cars in each class cars 1 2 3 4 5 6 7 8 9 10 option 1 1 0 0 0 0 0 1 1 1 1 option 2 0 0 1 1 1 1 0 0 1 1 option 3 1 0 0 0 0 0 1 1 0 0 option 4 1 1 0 0 1 1 0 0 0 0 option 5 0 0 1 1 0 0 0 0 0 0 classes 1 2 3 4 5 6 option 1 1 0 0 0 1 1 option 2 0 0 1 1 0 1 option 3 1 0 0 0 1 0 option 4 1 1 0 1 0 0 option 5 0 0 1 0 0 0 no. of cars 1 1 2 2 2 2 CP Summer School September 2005 3/4

Symmetry between Variables: Golfers Problem 32 golfers want to play in 8 groups of 4 each week, so that any two golfers play in the same group at most once. Find a schedule for n weeks One viewpoint has 0/1 variables x ijkl : x ijkl = 1 if player i is the j th player in the k th group in week l, and 0 otherwise. The players within each group could be permuted in any solution to give an equivalent solution also the groups within each week, the weeks within the schedule and the players themselves CP Summer School September 2005 3/5

Reformulating to avoid symmetry: Set Variables Eliminate the symmetry between players within a group by using set variables to represent the groups G kl represents the k th group in week l the value of G kl represents the set of players in the group. The constraints on these variables are that: the cardinality of each set is 4 the sets in any week do not overlap: for all l, the sets G kl, k = 1,...,8 have an empty intersection any two sets in different weeks have at most one member in common Constraint solvers that support set variables allow constraints of this kind CP Summer School September 2005 3/6

Symmetry Breaking Often, not all the symmetry can be eliminated by remodelling Remaining symmetry should be reduced or eliminated: dynamic symmetry breaking methods (SBDS, SBDD, etc.) symmetry-breaking constraints unlike implied constraints, they change the set of solutions can lead to further implied constraints CP Summer School September 2005 3/7

Example: Template Design Plan layout of printing templates for catfood boxes Each template has 9 slots 9 boxes from each sheet of card Choose best layout for 1, 2, 3, templates to minimize waste in meeting order templates are expensive Flavour Order (1000s) Liver 250 Rabbit 255 Tuna 260 Chicken Twin 500 Pilchard Twin 500 Chicken 800 Pilchard 1,100 CP Summer School September 2005 3/8

One Template Solution Flavour Order (1000s) Liver 250 Rabbit 255 Tuna 260 Chicken Twin 500 Pilchard Twin 500 Chicken 800 Could meet the order using only one template print it 550,000 times but this wastes a lot of card Pilchard 1,100 CP Summer School September 2005 3/9

CP Model for Template Design For a fixed number of templates: x ij = number of slots allocated to design j in template i r i = run length for template i (number of sheets printed from this template) i x ij r i d j j = 1, 2,, 7 minimize p = i r i (p = total sheets printed) CP Summer School September 2005 3/10

Symmetry Breaking & Implied Constraints The templates are indistinguishable So add r 1 r 2 r t If there are 2 templates: at most half the sheets are printed from one template, at least half from the other so r 1 p/2; r 2 p/2 For 3 templates: r 1 p/3; r 2 p/2; r 3 p/3 These are useful constraints they allow tighter constraints on the objective to propagate to the search variables CP Summer School September 2005 3/11

Changing Viewpoint We can improve a CSP model of a problem express the constraints better break the symmetry add implied constraints But sometimes it s better just to use a different model i.e. a different viewpoint CP Summer School September 2005 3/12

Different Viewpoints Reformulate in a standard way, e.g. non-binary to binary translations dual viewpoint for permutation problems Boolean to integer or set viewpoints Find a new viewpoint by viewing the problem from a different angle the constraints may express different insights into the problem CP Summer School September 2005 3/13

Permutation Problems A CSP is a permutation problem if: it has the same number of values as variables all variables have the same domain each variable must be assigned a different value Any solution assigns a permutation of the values to the variables Other constraints determine which permutations are solutions There is a dual viewpoint in which the variables and values are swapped CP Summer School September 2005 3/14

Example: n-queens Standard model a variable for each row, x 1, x 2,, x n values represent the columns, 1 to n x i =j means that the queen in row i is in column j n variables, n values, alldifferent(x 1, x 2,, x n ) Dual viewpoint a variable for each column, d 1, d 2,, d n ; values represent the rows In this problem, both viewpoints give the same CSP CP Summer School September 2005 3/15

Example: Magic Square First viewpoint: variables x 1, x 2,, x 9 values represent the numbers 1 to 9 The assignment (x i,j) means that the number in square i is j Dual viewpoint a variable for each number, d 1, d 2,, d 9 values represent the squares Constraints are much easier to express in the first viewpoint see earlier x 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 CP Summer School September 2005 3/16

Boolean Models Permutation problems: another viewpoint has a Boolean variable b ij for every variable-value combination e.g. in the n-queens problem, b ij =1 if there is a queen on the square in row i and column j, 0 otherwise A Boolean viewpoint can be derived from a CSP viewpoint with integer or set variables (or v.v.) in an integer viewpoint, b ij = 1 is equivalent to x i = j in a set-variable viewpoint, j X i is equivalent to b ij = 1 The Boolean viewpoint often gives a less efficient CSP than the integer or set model the reverse translation can be useful CP Summer School September 2005 3/17

Different Perspectives: Example Constraint Modelling Challenge, IJCAI 05 Minimizing the maximum number of open stacks A manufacturer has a number of orders from customers to satisfy each order is for a number of different products, and only one product can be made at a time once a customer's order is started (i.e. the first product in the order is made) a stack is created for that customer when all the products that a customer requires have been made, the stack is closed the number of stacks that are in use simultaneously i.e. the number of customer orders that are in simultaneous production, should be minimized CP Summer School September 2005 3/18

Minimizing Open Stacks Example The product sequence shown needs 4 stacks But if customer 3 s products are made before (or after) customer 4 s, only 3 are needed 3 is the minimum possible because product 2 is for 3 customers products 1 2 3 4 5 6 customer 1 0 1 0 0 0 1 customer 2 1 1 1 0 0 1 customer 3 1 0 0 1 0 1 customer 4 0 1 0 0 1 0 CP Summer School September 2005 3/19

Open Stacks Possible Viewpoints Variables are positions in production sequence, values are products a permutation problem so has a dual viewpoint products 1 2 3 4 5 6 customer 1 0 1 0 0 0 1 customer 2 1 1 1 0 0 1 customer 3 1 0 0 1 0 1 customer 4 0 1 0 0 1 0 In constructing the product sequence, at any point, products that are only for customers that already have open stacks can be inserted straightaway e.g. if product 1 is first, products 3 & 4 can follow the next real decision is whether to open a stack for customer 1 or 4 next (or both) leads to a viewpoint based on customers CP Summer School September 2005 3/20

Open Stacks Customer Viewpoints Variables are positions in customer sequence, values are customers r i = j if the i th customer to have their order completed is j A variable for each customer, values are stack locations customers ordering the same product cannot share a stack location a graph colouring problem with additional constraints A Boolean variable for each pair of customers 0 means they share a stack location, 1 means that they don t NB we want to maximize the number of customers that can share a stack location CP Summer School September 2005 3/21

Summary Symmetry Look out for symmetry in the CSP avoid it if possible by changing the model eliminate it e.g. by adding constraints does this allow more implied constraints? Viewpoints don t stick to the first viewpoint you thought of, without considering others think of standard reformulations think about the problem in different ways CP Summer School September 2005 3/22