Applications of Constraint Programming H.Simonis
description
Transcript of Applications of Constraint Programming H.Simonis
04/24/23 1
Applications of Constraint Programming
H.Simonis
2
What is common among
The production of Mirage 2000 fighter aircraft The personnel planning for the guards in all French jails The production of Belgian chocolates The selection of the music programme of a Pop music radio
station The design of advanced signal processing chips The print engine controller in Xerox copiers
They all use constraint programming to solve their problem
3
Constraint Programming - in a nutshell
Declarative description of problems with Variables which range over (finite) sets of values Constraints over subsets of variables which restrict possible value
combinations A solution is a value assignment which satisfies all constraints
Constraint propagation/reasoning Removing inconsistent values for variables Detect failure if constraint can not be satisfied Interaction of constraints via shared variables Incomplete
Search User controlled assignment of values to variables Each step triggers constraint propagation
Different domains require/allow different methods
4
Constraint Satisfaction Problems (CSP)
Different problems with common aspects Planning Scheduling Resource allocation Assignment Placement Logistics Financial decision making VLSI design
5
Characteristics of these problems
There are no general methods or algorithms NP-completeness different strategies and heuristics have to be tested.
Requirements are quickly changing: programs should be flexible enough to adapt to these changes
rapidly.
Decision support required co-operate with user friendly interfaces
6
Benefits of CLP approach
Short development time Fast prototyping Refining of modelling Same tool used for prototyping/production
Compact code size Ease of understanding Maintenance
Compositional development Changing requirements are localized No need to understand all aspects of problem to add/change constraint
Good performance Fast answer Good results Optimal solutions rarely required
Adapt solution to problem, not vice versa Bespoke application development
7
Logic Programming
Mathematics
Operations ResearchCLP toolsArtificial
Intelligence
Constraint propagationConsistency checkingDemons
Graph theoryCombinatoricsSpatial data structuresEquation solving
methods
Predicate logicUnificationNon-determinism
Simplex & Linear programmingInteger programmingImplicit enumerationBranch & boundFlow algorithmsScheduling methods
Techniques behind CLP
8
Eclipse
Prolog based “constraint toolkit” Developed first at ECRC, then IC-Parc Easy to develop new constraint methods Sets of existing methods/libraries Basis of problem solvers for PT Widely used for academic work (> 500 sites)
9
Example problem
Solve the cryptarithmetic puzzle
Each character represents a digit Different characters have different values Numbers do not start with 0
SEND +MORE------ MONEY
10
Example: Model
top:-[S, E, N, D, M, O, R, Y] :: 0..9, alldifferent([S, E, N, D, M, O, R, Y]), S \= 0, M \= 0, 1000 * S + 100*E + 10*N + D +1000*M + 100*O + 10*R + E =10000 *M + 1000*O + 100*N + 10*E + Y, labeling([S, E, N, D, M, O, R, Y]).
Variable definition
Constraints betweenvariables
Search routine
11
Constraint reasoning
Simplification (each variable occurs once) 1000*S in {1..9}+ 91*E in {0..9} + D in {0..9} + 10*R in {0..9} = 9000*M in {1..9}
+900*O in {0..9} + 90*N in {0..9} + Y in {0..9}
Evaluation lhs/rhs lhs in 1000..9918 rhs in 9000..89919
Merging of sides constraint in 9000..9918
Consequence M = 1 S = 9 O in {0..1}
Propagation of alldifferent O = 0
12
Reasoning
Re-evaluation of equality 1000*9+ 91*E in {2..8} + D in {2..8} + 10*R in {2..8} = 9000*1
+900*0 + 90*N in {2..8} + Y in {2..8} lhs in 9204..9816, rhs in 9182..9728, eq in 9204..9728 N \= 2, E \= 8
Re-evaluation, ... Continuing the process gives
M = 1, S = 9, O = 0, E in 4..7, N in 5..8, D in 2..8, R in 2..8, Y in 2..8
13
Starting labeling
First variable is E, first value is 4 Propagation on equality gives
1000*9+ 91*4 + D in {2..8} + 10*R in {2..8} = 9000*1 +900*0 + 90*N in {5..8} + Y in {2..8}
results in N = 5, D = 8, R = 8, Y = 2
Propagation on alldifferent fails Backtracking to last choice
14
First alternative
Next value for E is 5 Propagation on equality gives
1000*9+ 91*5 + D in {2..8} + 10*R in {2..8} = 9000*1 +900*0 + 90*N in {5..8} + Y in {2..8}
results in N = 6, R = 8
Constraint propagation (alldifferent + equality) gives D = 7, Y = 2
Problem solved
15
Points to remember
Even small problems create complex propagation chains The same constraint can be woken several times in the same
propagation loop The order in which constraints are woken has an influence on
the speed, but not on the result Propagation continues until no further information is obtained Search (under user control) required to find ground solution Basic structure of finite domain program always the same
define variables define constraints user defined search
typical: pick variable and find value
04/24/23 16
Success Stories for Constraint Logic Programming
COSYTEC – IC-Parc
17
Overview
Hardware design Compilation Financial problems Placement Cutting problems Stand allocation Air traffic control Frequency allocation Network configuration Product design Production step planning Production sequencing
Production scheduling Satellite tasking Maintenance planning Product blending Time tabling Crew rotation Aircraft rotation Transport Personnel assignment Personnel requirement
planning
18
Five central topics
Assignment Parking assignment Platform allocation
Network Configuration Scheduling
Production scheduling Project planning
Transport Lorry, train, airlines
Personnel assignment Timetabling, Rostering Train, airlines
19
Stand allocation
HIT (ICL Hong-Kong) assign ships to berths in container harbour developed with ECRC’s version of CHIP then using DecisionPower (ICL) first operational constraint application (1989-90)
APACHE (COSYTEC) stand allocation for airport
Refinery berth allocation (ISAB) where to load/unload ships in refinery
20
AIR FRANCE - APACHE
Stand allocation system Originally developed for Air France, CDG2 Packaged for large airports
Complex constraint problem Technical & operational constraints Incremental re-scheduler
Cost model Max. nb passengers in contact Min. towing, bus usage
Benefits and status Quasi real-time re-scheduling KAL, Turkish Airlines
21
Network configuration
RiskWise (PT) Locarim (France Telecom, COSYTEC)
cabling of building
Planets (UCB, Enher) electrical power network reconfiguration
Load Balancing in Banking networks (ICON) distributed applications control network traffic
Water Networks (UCB, ClocWise)
22
RiskWise
Traffic analysis/optimization for IP networks Find out end-to-end communication flows in the
network of an ISP Suggest changes in network which optimize
investment Handle incomplete data
23
FRANCE TELECOM - LOCARIM
Intelligent cabling system for large buildings developed with Telesystemes for France Telecom
Application input scanned drawing specify requirements
Optimization minimize cabling, drilling Reduce switches shortest path
Status operational in 5 Telecom sites generates quotations
24
Production scheduling
Atlas (Monsanto) Herbizide production
Cerestar (OM Partners) Glucose production
KAPSS (Mitsubishi Chemical) offset printing plates
Trefi Metaux (Sligos) heavy industry production scheduling
Michelin rubber blending, rework optimization
25
ATLAS (Monsanto)
Scheduling system in chemical factory herbicide manufacturing and packaging integrated inventory control system
Life system first phase operational since July 93 second phase operational since March 94 major revision in 98 (SAP connection)
Developed jointly by OM Partners (Antwerp) COSYTEC
Multi-user system multiple schedulers co-operative behavior
Gr
G
F1
F2
Dr
L1
L2
L3
L4
PackagingFormulation
raw material
Holdingarea
Out finishedproducts
26
DASSAULT - PLANE
Assembly line scheduling developed by Dassault Aviation for Mirage 2000 Jet/ Falcon business jet
Two user system production planning 3-5 years commercial what-if sales aid
Optimisation requirement to balance schedule minimise changes in production rate minimise storage costs
Benefits and status replaces 2 week manual planning operational since Apr 94 now used in US for business jets
27
FINA - FORWARD
Oil refinery production scheduling joint development by TECHNIP and COSYTEC incorporates ELF FORWARD LP tool
Schedules daily production crude arrival -> processing -> delivery design, optimize and simulate
Product Blending explanation facilities handling of over-constrained problems
Status generic tool developed in 240 man days operational since June 94 Operational at FINA, ISAB, BP
28
Transport
By Air AirPlanner (PT) Daysy (Lufthansa) Pilot (SAS)
By Road Wincanton (IC-Parc) TACT (SunValley) EVA (EDF)
By Rail CREW (Servair) COBRA (NWT)
29
EDF- EVA
Transportation of nuclear waste developed by GIST + COSYTEC plans evacuation and transport for 54 sites
Constraints availability of transport vehicles and vessels no and capacity of storage tanks compatibility of waste to vessels size of convoy, time
Status operational since Oct 94 6 month plan in 5 minutes
30
SERVAIR - CREW
Crew rostering system assign service staff to TGV train timetable joint implementation with GSI
Problem solver generates tours/cycles assigns skilled personnel
Constraints union, physical, calendar
Status operational since Mar 1995 cost reduction by 5%
31
Personnel Planning
RAC (IC-Parc) OPTISERVICE (RFO) Shifter (ERG Petroli) Gymnaste (UCF) MOSAR (Ministère de la JUSTICE)
32
RFO - OPTI SERVICE
Assignment of technical staff to tasks overseas radio broadcasting network - Radio France Outre-mer joint development by GIST and COSYTEC 250 journalists and technicians
Features schedule manually, check, automatic rule builder to specify cost formulas
Optimization minimize overtime, temporary staff compute cost of schedule
Status operational since 1997 installed worldwide in 8 sites
Now used for other companies TSR Canal+
33
Rostering
Ministère de la JUSTICE Rostering of prison guards Help to determine personnel needs Simulation / Calculation of anonymous rosters Provisional plans for one year Development by Cisi and COSYTEC 10 regional sites for 200 prisons Objectives :
planning obtained in minutes was 3 weeks manually
reduction of overtime cost improved personnel satisfaction reduction of days lost
04/24/23 34
Case Study: A complex transportation problem
35
TACT: Transport planning and resource scheduling
Transport planning and scheduling for SVF/Cargill UK delivering chicken/turkeys from farms to factories JIT arrival at factory combined
planning scheduling assignment
multi-resource problem, interaction between resource types
Developed by COSYTEC Operational since 2/95 Revising decision making process
formalizing current procedures spread knowledge inside company
36
Problem
Satisfy order book with available resources Transport Qty of Type from Source
to Sink
Schedule operations Assign resources to activities
Depot Tour generation Start in depot Connect orders to tours Use of passive transport End in depot
37
Integrated transport problem
Loading Teams, Drivers, Forklifts, Lorries
Transport Drivers, Lorries, Forklifts
Unloading Drivers, Personnel, Storage Area, Lorries
Cleaning Personnel, Lorries, Forklifts
38
Menubar
List
Gantt chart
Application Look
Details and status
39
Solver Architecture
Orders
Plan
Schedule
Assignment
How many trips?
When to leave or to arrive?
Who is doing what?
40
Planning
How many trips are required lorry types drag trailers transport restriction volume/weight limits
Merging of orders same source/sink same type
Fork lift requirements resource needed for loading take out with first trip bring back with last trip optimization
41
Scheduling
On departure side all trips for same order must be
scheduled together no gaps no concurrency loading times depend on team, lorry type
and product
On arrival side JIT schedule producer/consumer behavior very limited storage area limited storage time minimum stock level required
42
Producer/Consumer Behavior
43
Assignment
Find compatible resources for each activity multiple resource problem interaction between resources conflict resolution
Respect constraints working time rest periods work load
Balance use of resources of same type teams drivers
Minimize use of outside resources
44
User control
The user is in command modification of constraints choice of strategies relaxation of constraints
Different priorities of various users in-time delivery use of resources need for overtime balancing work load
Need for compromise Improved reactivity
events rescheduling
45
Problem solver
Large scale, complex model Inter-related problem solvers Use of global constraints essential
cumulative diffn cycle
Explanation facilities meta programming (Prolog feature) relaxation of global constraints possible in CHIP
Re-scheduling/re-use of existing solution Constraint solver / constraint check
46
The Cumulative global constraint
Cumulative constraint– Resource limits over periods of time– Upper/lower limits– Soft/hard limits– Gradual constraint relaxation
Application– Resource restrictive scheduling, producer consumer constraints,
disjunctive schedule, manpower constraints, overtime
cumulative
47
Cumulative
Methods obligatory parts task intervals available space many more (25000 lines of C code)
Concepts one constraint may be used for different purposes
48
The Diffn global constraint
Diffn constraint– non overlapping areas on n-dimensional rectangles– distances between rectangles– limit use of areas– relaxation
Application– layout, packing, resource assignment, setup,
distribution planning, time-tabling
diffn
49
Diffn
Methods obligatory parts region intervals max flow on assignment available space many others (32000 lines of C code)
Concepts
50
The Cycle global constraint
cycle
Cycle constraint– Finds cycles in directed graphs with minimal cost– Assign resources, find compatible start dates
Applications– Tour planning, personnel rotation, distribution
problems, production sequencing
51
Cycle
Methods connected components bi-partite matching non-oriented graph concepts shortest/longest paths micro-rules many others (38000 lines of C code)
Concepts
52
Evaluation
Operational since spring 1995 Scheduling speed
8 hours manual work 15 min with TACT application
Return on investment (estimated by customer) in 6 month transport fleet constant at increasing demand
Push button solution little manual interaction
Application has stayed up-to-date for last five years new types of lorries changing status of catching teams ...
53
Statistics
10 month project duration study, specification development implementation
36000 lines of CHIP code complete application in CHIP except AS/400 interface to ORACLE
7000 lines of code for solver explanation facilities automated constraint relaxation specialized lower bound calculation
54
Summary
Large scale problems can be solved with CLP Very high level language + framework allows rapid
development in industrial terms
Complex, customer specific conditions can be handled Global constraints allow
Expression Resolution of complex problems
Most important Ease of modelling Speed of development Reactivity to customer demands
55
Some pointers
Constraint Archive www.cs.unh.edu/ccc/archive
Constraints Journal www.wkap.nl/journals/constraints
Principles and Practice of Constraint Programming www.cs.ualberta.ca/~ai/cp CP99 in Washington,DC/ CP2000 in Singapore
Practical Application of Constraint Technologies and Logic Programming www.practical-applications.co.uk/PACLP99
On-line guide to Constraint Programming (R. Bartak) http://kti.mff.cuni.cz/~bartak/constraints
K. Marriott, P.J. Stuckey Programming with Constraints: An Introduction, MIT Press, 1998