Constraint Programming (CP)



Similar documents
Smart Graphics: Methoden 3 Suche, Constraints

A hybrid approach for solving real-world nurse rostering problems

Ant Colony Optimization and Constraint Programming

A Constraint Programming Application for Rotating Workforce Scheduling

Integrating Benders decomposition within Constraint Programming

Heuristics for Dynamically Adapting Constraint Propagation in Constraint Programming

A Constraint Programming based Column Generation Approach to Nurse Rostering Problems

Y. Xiang, Constraint Satisfaction Problems

INTEGER PROGRAMMING. Integer Programming. Prototype example. BIP model. BIP models

Constraint Programming. Master Parisien de Recherche en Informatique

An Interactive Train Scheduling Tool for Solving and Plotting Running Maps

The Problem of Scheduling Technicians and Interventions in a Telecommunications Company

A search based Sudoku solver

Disjunction of Non-Binary and Numeric Constraint Satisfaction Problems

Parametric Attack Graph Construction and Analysis

Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams

npsolver A SAT Based Solver for Optimization Problems

The MiniZinc Challenge compares different solvers on a

Satisfiability Checking

A Tool for Generating Partition Schedules of Multiprocessor Systems

LocalSolver: black-box local search for combinatorial optimization

EFFICIENT KNOWLEDGE BASE MANAGEMENT IN DCSP

Representing and Solving Rule-Based Decision Models with Constraint Solvers

Solving the chemotherapy outpatient scheduling problem with constraint programming

Airport Planning and Design. Excel Solver

Solving WCSP by Extraction of Minimal Unsatisfiable Cores

Global Multiprocessor Real-Time Scheduling as a Constraint Satisfaction Problem

FACULTY OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGY AUTUMN 2016 BACHELOR COURSES

Solving convex MINLP problems with AIMMS

A Working Knowledge of Computational Complexity for an Optimizer

School of Computer Science

A Generic Visualization Platform for CP

Goals of the Unit. spm adolfo villafiorita - introduction to software project management

Cloud Branching. Timo Berthold. joint work with Domenico Salvagnin (Università degli Studi di Padova)

Discrete Optimization

Introduction. Real World Planning. Planning with Time. Time 15/11/2012. COMP219: Artificial Intelligence. COMP219: Artificial Intelligence

Winter 2016 Course Timetable. Legend: TIME: M = Monday T = Tuesday W = Wednesday R = Thursday F = Friday BREATH: M = Methodology: RA = Research Area

University of Potsdam Faculty of Computer Science. Clause Learning in SAT Seminar Automatic Problem Solving WS 2005/06

Checking for Dimensional Correctness in Physics Equations

Implementation of Complex Projects Using Constraint Programming

Contents. System Development Models and Methods. Design Abstraction and Views. Synthesis. Control/Data-Flow Models. System Synthesis Models

Computational Mathematics with Python

Software Verification: Infinite-State Model Checking and Static Program

A MODEL TO SOLVE EN ROUTE AIR TRAFFIC FLOW MANAGEMENT PROBLEM:

Calc Guide Chapter 9 Data Analysis

Chapter 13: Binary and Mixed-Integer Programming

Chapter 12 Discovering New Knowledge Data Mining

Integration of ACO in a Constraint Programming Language

M. Sugumaran / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 2 (3), 2011,

A Shift Sequence for Nurse Scheduling Using Linear Programming Problem

Bogdan Vesovic Siemens Smart Grid Solutions, Minneapolis, USA

STUDY OF PROJECT SCHEDULING AND RESOURCE ALLOCATION USING ANT COLONY OPTIMIZATION 1

5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1

Overview. Swarms in nature. Fish, birds, ants, termites, Introduction to swarm intelligence principles Particle Swarm Optimization (PSO)

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Computational Mathematics with Python

Nan Kong, Andrew J. Schaefer. Department of Industrial Engineering, Univeristy of Pittsburgh, PA 15261, USA

FPGA area allocation for parallel C applications

Search methods motivation 1

Constrained Local Search Method for Bus Fleet Scheduling Problem with Multi-depot with Line Change

Introduction. Abstract

On the Efficiency of Backtracking Algorithms for Binary Constraint Satisfaction Problems

Crew Assignment via Constraint Programming: Integrating Column Generation and HeuristicTreeSearch

Constraints Propagation Techniques in Batch Plants Planning and Scheduling

Static Analysis. Find the Bug! : Analysis of Software Artifacts. Jonathan Aldrich. disable interrupts. ERROR: returning with interrupts disabled

Project management: a simulation-based optimization method for dynamic time-cost tradeoff decisions

An Integer Programming Model for the School Timetabling Problem

CONSTRAINT LOGIC PROGRAMMING. Ivan Bratko Faculty of Computer and Information Sc. University of Ljubljana Slovenia

Regular Expressions and Automata using Haskell

Research Article Scheduling IT Staff at a Bank: A Mathematical Programming Approach

Quaderni del Dipartimento di Matematica e Informatica Università degli Studi di Parma. Gianfranco Rossi 1, Federico Bergenti 2

MAC Scheduling for High Throughput Underwater Acoustic Networks

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

Using Business Intelligence to Mitigate Graduation Delay Issues

Journal of Mathematics Volume 1, Number 1, Summer 2006 pp

Binary Image Reconstruction

A Flexible Mixed Integer Programming framework for Nurse Scheduling

Integrated maintenance scheduling for semiconductor manufacturing

William E. Hart Carl Laird Jean-Paul Watson David L. Woodruff. Pyomo Optimization. Modeling in Python. ^ Springer

SYSTEMS, CONTROL AND MECHATRONICS

Load Balance Strategies for DEVS Approximated Parallel and Distributed Discrete-Event Simulations

This paper introduces a new method for shift scheduling in multiskill call centers. The method consists of

STRATEGIC CAPACITY PLANNING USING STOCK CONTROL MODEL

Interactive Timetabling

Transcription:

Constraint Programming (CP) evita Winter School 2009 Optimization Tomas Eric Nordlander

Outline Constraint Programming History Constraint Satisfaction Constraint Satisfaction Problem (CSP) Examples Optimisation Many solution Over constrained Commercial Application Pointers Summary

Constraint Programming (CP) The basic idea of Constraint programming is to solve problems by stating the constraints involved the solution should satisfy all the constraints. It is an alternative approach to functional programming, that combines reasoning and computing techniques over constraints. Constraint satisfaction Constraint satisfaction deals mainly with finite domains Combinatorial solving methods Constraint solving Constraint satisfaction deals mainly with infinite domains Solving methods based more on mathematical techniques (Example: Taylor series)

A Brief History of Constraint Programming Sixties Sketchpad, also known as Robot Draftsman (Sutherland in, 1963). Seventies The concept of Constraint Satisfaction Problem (CSP) was developed (Montanari 1974). The scene labelling problem, (Waltz, 1975). Experimental languages. Eighties Constraint logic programming. Constraint Programming. Nineties Successfully tackled industrial personnel, production and transportation scheduling, as well as design problems. The last and the upcoming years Constraint Programming one of the basic technologies for constructing the planning systems. Research Focus: Constraint Acquisition, Model Maintenance, Ease of Use, Explanation, Dynamic Constraints, Hybrid techniques, Uncertainty, etc..

CP Interdisciplinary Nature Operational Research Artificial Intelligence Constraint Programming Discrete Mathematics Logic programming

Outline Constraint Programming History Constraint Satisfaction Constraint Satisfaction Problem (CSP) Examples Optimisation Many solution Over constrained Commercial Application Pointers Summary

What components are there? Model Constraint Satisfaction Problem (CSP) Search Algorithms Consistency Algorithms Heuristics Solving a CSP achieve one of the following goals: demonstrate there is no solution; find any solution; find all solutions; find an optimal, or at least a good, solution given some objective evaluation function. 7

CSP Model Constraint Satisfaction Problem (CSP) Definition 0,1,2 a set of variables X={X1,..., Xn}, for each variable Xi, a finite set Di of possible values (its domain), and <> X2 < a set of constraints C, where each constraint C<j> is composed of a scope vars(c<j>) of the variables that participate in that constraint and a relation rel(c<j>) Dj1 Dj2 Djt, that specifies the values that variables in the scope can be assigned simultaneous X1 X3 = 0,1,2 0,1,2

CSP: Search Simple Backtrack (BT) 0,1,2 Heuristic Variable ordering X1 X3 Value ordering 0 2 <> X2 01 2 < X1 01 = X3 012 0,1,2 0,1,2

CSP: Search Simple Backtrack (BT) Heuristic Variable ordering X1 X3 Value ordering 0 2 S 0 1 2 00 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2

CSP: Constraint Propagation Constraint propagations through consistency techniques Arc Consistency {X2-X3} <> X2 0,1,2 < X1 0 = X3 0,1,2 0,1,2

CSP: Constraint Propagation Example of Arc Consistency Arc Consistency {X2-X3} Arc Consistency {X1-X3} Arc Consistency {X2-X1}

CSP: seems fairly limited? CSP and solving methods are much richer then previous example showed, in particular when it comes to: Domain Constraints Search Consistency techniques

CSP: Domain and Constraints Domain finite (but also continues) Integer Reals Boolean (SAT) String Combinations of above Constraints linear (but also nonlinear) Unary Binary Higher arity Global Constraints

CSP: Search & Consistency tech. General algorithms Generate and Test Simple Backtracking Intelligent Backtracking Constraint propagations Node* Consistency Arc** Consistency Path Consistency Algorithms using consistency checking Forward Checking (FC) Partial Look Ahead (PLA) Full Look (FL) Maintaining Arc Consistency (MAC) *Node = Variable **Arc = Constraint 15

CSP: Modelling Critical for success Very Easy and very hard Often Iterative process Open CSP Dynamic CSP Trick includes Aux. constraints Redundant to avoid trashing Remove some solution to break symmetry Specialized constraints Aux. Variables Etc. 16

Outline Constraint Programming History Constraint Satisfaction Constraint Satisfaction Problem (CSP) Examples Optimisation Many solution Over constrained Application areas Pointers Summary

CSP Examples Graph Colouring Scheduling

Graph Coloring The graph colouring problem involves assigning colours to vertices in a graph such that adjacent vertices have distinct colours. This problem relates to problem such as scheduling, register allocation, optimization.

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring We reach a end node without being able to generate a solution so we need to backtrack

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring Variable order: A-F Value order: Red, Green, Blue.

Graph Coloring

Graph Coloring

Graph Coloring

Graph Colouring (SICStus Prolog) :- use_module(library(clpfd)). solve_africa(a,b,c,d,e,f):- domain([a,b,c,d,e,f], 1, 3), % Variables & their domain size % colour 1=RED, 2=GREEN or 3=BLUE A #\= B, % Constraints A #\= F, B #\= F, B #\= C, F #\= E, C #\= E, C #\= D, E #\= D, labeling([],[a,b,c,d,e,f]). % assign values to the Variables?- solve_africa (A,B,C,D,E,F). A = 1, B = 2, C = 1, D = 3, E = 2, F = 3? yes?-

CSP example: Scheduling We have 7 patients that need different surgeries. Our 4 Operations rooms are open 24/7 We have 13 people in our medical staff, each surgery demands one or more from the staff. Exp. Duration (h) 16 6 13 7 5 18 4 Resource demand (number of Staff) 2 9 3 7 10 1 11 Starting time??????? Give us the optimal plan (starting time for the surgical task) to minimize the total end time?

A optimal solution! An optimal schedule, all surgeries are conducted within 23 hours. 100% 50% 0% Staff Room 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Utilisation of the 13 staff and the 4 rooms 39

CSP example: Scheduling :- use_module(library(clpfd)). :- use_module(library(lists), [append/3]). schedule(ss, Rs, End) :- length(ss, 7), Ds = [16,6,13,7,5,18,4], Rs = [2,9,3,7,10,1,11], domain(ss,1,30), domain([end],1,50), after(ss, Ds, End), cumulative(ss, Ds, Rs, 13), append(ss, [End], Vars), labeling([minimize(end)], Vars). */ TASK DURATION RESOURCE ==== ======== ======== t1 16 2 t2 6 9 t3 13 3 t4 7 7 t5 5 10 t6 18 1 t7 4 11 /* after([], [], _). after([s Ss], [D Ds], E) :- E #>= S+D, after(ss, Ds, E). %% End of file?- schedule(ss,rs,end). Rs = [2,9,3,7,10,1,11], Ss = [1,17,10,10,5,5,1], End = 23? yes?-

Outline Constraint Programming History Constraint Satisfaction Constraint Satisfaction Problem (CSP) Examples Optimisation Many solution Over constrained Commercial Application Pointers Summary

Optimisation Case A: If there are many solution to the problem Use some criteria to select the best one E.g a cost function Case B: If all constraints in a problem cannot be satisfied Seek the best partial solution E.g. use MAX-CSP or Constraint hierarchy

Optimization: Case A Cost function The previous example simply found single solution A complete search discover two more solutions We can use a simple cost function to find the optimal solution As an example take Cost function = 5X1 + 2X2 1X2 2 1 0 0 1 2 2 1 2

Optimization: Case B Over constrained problem: Not uncommon that real world problem is overconstrained Solution, relaxation by removing constraints. Allow user to select constraint(s) associate a cost with each constraint violation (known in mathematical programming as Lagrangian relaxation Constraint hierarchies 44

Constraint Hierarchies constraints are partitioned into levels, {H0, H1,.., Hn} H0 contain hard constraints that must be satisfied H1 Hn hold soft constraints of decreasing priority or strength If the CSP H0 have a solution start adding constraints from the next hierarchy. CSP H0 Soft Constraints 45

Constraint Hierarchies Solution Space Example CSP H0 CSP H1 CSP H1 CSP H01 A Solution? 46

Outline Constraint Programming History Constraint Satisfaction Constraint Satisfaction Problem (CSP) Examples Optimisation Many solution Over constrained Application areas Pointers Summary

Commercial Application: examples Airline crew scheduling - XLufthansa: (OR + CP) The counter allocation problem - Hong Kong International Airport. structure prediction of lattice proteins with extended alphabets Nurse rostering - GATsoft (Norweigen hospitals) (CP + LS) Planning and Scheduling space exploration - Component Library for NASA Staff planning BanqueBuxelles Lambert Vihivle production optimization Chrysler Corperation Planning medical appointments FREMAP Task scheduling Optichrome computer systems Resource allocation SNCF From Push to Pull manufacturing Whirlpool Utility service otimization Long island lighting company Intelligent cabling of big building France Telecom Financial DSS Caisse des Depots Load Capacity constraint regulation Eurocontrol Planning satellites mission Alcatel Espace Optimization of configuration of telecom equipment Alcatel CIT Production Scheduling of herbicides Monsanto Just in time transport and logistic in food industri Sun Valley Etc. 48

Pointers: Background reading http://www.cs.toronto.edu/~fbacchus/csc2512/biblio.html Nordlander, T.E., (2004) 'Constraint Relaxation Techniques & Knowledge Base Reuse', University of Aberdeen, PhD Thesis, pp. 246. 49

Pointers: Constraint Logic Languages SCREAMER (LISP, open software) B-Prolog (Prolog based, proprietary) CHIP V5 (Prolog based, also includes C++ and C libraries, proprietary) Ciao Prolog (Prolog based, Free software: GPL/LGPL) ECLiPSe (Prolog based, open source) SICStus (Prolog based, proprietary) GNU Prolog YAP Prolog SWI Prolog a free Prolog system containing several libraries for constraint solving Claire 50

Pointers: Libraries for CP Choco (Java library, free software: X11 style) Comet (C style language for constraint programming, free binaries available for non-commercial use) Disolver (C++ library, proprietary) Gecode (C++ library, free software: X11 style) Gecode/J (Java binding to Gecode, free software: X11 style) ILOG CP Optimizer (C++, Java,.NET libraries, proprietary) ILOG CP (C++ library, proprietary) JaCoP (Java library, open source) JOpt (Java library, free software) Koalog Constraint Solver (Java library, proprietary) Minion (C++ program, GPL) python-constraint (Python library, GPL) Cream (Java library, free software: LGPL) (Microsoft Solver Foundation (free up to a certain problem size) ) 51

Summary Constraint Programming History Constraint Satisfaction Constraint Satisfaction Problem (CSP) Examples Optimisation Many solution Over constrained Application areas Pointers Summary

References: (Bistarelli et al, 1997) S. Bistarelli, U. Montanari, and F. Rossi. Semiring-based constraint satisfaction and optimization. J. of the ACM, 44(2):201 236, 1997. (Montanari, 1974) (Sutherland, 1963) (Waltz, 1975) U. Montanari Networks of constraints: Fundamental properties and application to picture processing, Inf. Sci. 7, 95-132, 1974 Sketchpad (aka Robot Draftsman) was a revolutionary computer new electronic editionpdf (3.90 MiB) was published in 2003 Waltz, D.L.: Understanding line drawings of scenes with shadows, in: Psychology of Computer Vision, McGraw- Hill, New York, 1975 (Burke & Kendal, 2005) Edmund Burke, Graham Kendall. Search methodologies: Introduction tutorials in optimization and decision support techniques Tomas Eric Nordlander tomas.nordlander@sintef.no