04/19/23 1
Constraint Programming
for Industrial Applications
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)
Combinatorial Optimization Problems
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
Logic ProgrammingLogic Programming
MathematicsMathematics
Operations Research
Operations ResearchCLP toolsCLP toolsArtificial
Intelligence
ArtificialIntelligence
Constraint propagation
Consistency checking
Demons
Graph theory
Combinatorics
Spatial data structures
Equation solving methods
Predicate logic
Unification
Non-determinism
Simplex & Linear programming
Integer programming
Implicit enumeration
Branch & bound
Flow algorithms
Scheduling methods
Techniques behind CLP
7
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)
8
CLP tool history
Prolog III CLP(R) CHIP
Decision Power
CharmeSNI
Prolog
CHIPSEPIA
CHIP lib
CHIP V4
Charme Object
Solver
Pecos
logic based Other base language
CAL
BNR
cc(FD)
EclipseProlog IV
CHIP V5Oz Claire
ALICE
9
Classification of CLP solvers
Computation domain Deterministic solver (search under user control) Efficient methods More than one application
Complete/incomplete decide satisfiability of constraint sets complexity of solver/ simplicity of programs
Methods syntactic: domain independent semantic: domain dependent
10
Constraints
Boolean
semanticsyntacticValueselection
Variableselection
Backtracking
Heuristics
ConstraintsolverControl
element
BooleanFinitedomainsRational
Incompletesolver
Completesolver
disequality
numerical
inequalityequality
symbolic
cumulative diffn cycle among
Domain concept
Others Others
Constraint system structure
Interval
Meta-heuristics
sequence
11
Computation domains
Finite domains
Linear arithmetic
Boolean
Pseudo Boolean
Non-linear arithmetic
Intervals
Sets, sequences, lists
the initial domains in Prolog III,
CLP(R) and CHIP
12
Incomplete finite domain solver
Domain finite sets of values subsets of natural numbers
Need for enumeration
Classification criteria constraint granularity richness of constraint sets propagation results user definable constraints/control
Methods explicit domain representation bound propagation/ removal of interior values heuristics based on domains
13
Need for global constraints
Y in {2,3}
Z in {1,3}
U in {1,2,3,4}
X in {2,3}
Y
X
Z
U
1
2
3
4
local reasoning, no action global reasoning, detect implications by bi-partite matching
14
Global constraints
Work on sets of variables Global conditions, not local constraints
Semantic methods Operations Research Spatial algorithms Graph theory Network flows
Building blocks (high-level constraint primitives) Multi-purpose As general as possible Usable with other constraints Very strong propagation Acceptable algorithmic complexity
15
Constraint morphology
DifferentDifferent DependencyDependencyTourTourResourceResourceOrderOrder
\=\= >=, distance>=, distance atmost, atleastatmost, atleast circuitcircuit elementelement
alldifferentalldifferent
setupsetupdisjunctivedisjunctive
prod/consprod/conspermutationpermutation
diffndiffn cumulativecumulative sequencesequence
amongamong
cyclecycle casecase
precedenceprecedence
16
Search tree visualization
Generation of search tree representation at run-time
Shows parent child relation, failed sub-trees, success nodes
In examples here leaf failure nodes suppressed failure trees not collapsed
Interface a set of simple meta-call predicates
Supported by work in DISCIPL Esprit project Declarative debugging Visualization of constraint programming results
Understand behaviour of different strategies
17
Search tree tool
Menubar
Panel
Tree view
OtherViews,here domainstate
Info Area
18
Initial Credit 8
4 2 1
2 1 1
1
Local Search
Credit Search
Solution
*
credit([X1..X10],8,10,my_delete,
my_indomain,
4,part(1,2)),
Example of tree search
04/19/23 19
Success Stories for Constraint Logic Programming
COSYTEC – IC-Parc
20
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
21
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
22
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
23
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
24
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)
25
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
26
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
27
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
28
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
29
Transport
By Air AirPlanner (PT) Daysy (Lufthansa) Pilot (SAS)
By Road Wincanton (IC-Parc) TACT (SunValley) EVA (EDF)
By Rail CREW (Servair) COBRA (NWT)
30
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
31
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%
32
Personnel Planning
RAC (IC-Parc)
OPTISERVICE (RFO)
Shifter (ERG Petroli)
Gymnaste (UCF)
MOSAR (Ministère de la JUSTICE)
33
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+
04/19/23 34
Case Study: Semi Process Industry
35
ATLAS (Monsanto, Antwerp)
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 PC/UNIX system multiple schedulers co-operative behavior
36
Gr
G
F1
F2
Dr
L1
L2
L3
L4
PackagingFormulation
raw material
intermediate products
Holdingarea
Manufacturing Process
Outside
finishedproducts
37
ProductionPurchasing
Users
SchedulersFactory
PackagingFormulation
ProductionSchedule
Shop floor data
Sales forecast(6 month horizon)
Stock level
Data baseupdateplanned/realized
Orders(delay 1day to 4 weeks)
Arrivals(lead time 3 weeks)
Dynamic Scheduling Environment
38
ProductionPurchasing
Re-scheduling Formulation
Re-scheduling Packaging
New Schedule
Users Priorityorders
Visualization ofschedule
(stock level,delays,
down times...)
Productionproblems
Old scheduleFine tuningof sequence medium/long
termimpact
shortterm
reaction
Scheduling Process
SchedulersFactory
PackagingFormulation
39
IBM - VMAntwerp
IBM - MVSSAS
Brussels
ORACLE
X 25
USA
Ethernet PlannerFactory
SchedulerFormulation
SchedulerPackaging
Productionmanager
Purchasing
Users PC / XWindowsGUI
HP UNIX
SchedulingCHIP
Architecture
40
The system
Connection to other systems Data download/upload from/to local and remote mainframes End-user connection via PCs
Data base Local on UNIX machine ORACLE SQL standard Forms/reports facilities
Multi-user tool Multiple schedulers for parts of production Inventory control Production Multiple scenarios; one schedule
41
Constraint solver
Constraints handled Machine choice Sequence/ machine dependent set-up Manpower limits Component consumer constraints Finished product producer constraint Producer/consumer constraints for intermediate products Production planning for batch part
Number of batches for intermediate products Optimum batch sizing
Limited stock levels
42
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
43
Cumulative
Methods obligatory parts task intervals available space many more (25000 lines of C code)
Concepts one constraint may be used for different purposes
44
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
45
Diffn
Methods obligatory parts region intervals max flow on assignment available space many others (32000 lines of C code)
Concepts
46
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
47
Cycle
Methods connected components bi-partite matching non-oriented graph concepts shortest/longest paths micro-rules many others (38000 lines of C code)
Concepts
48
ATLAS - Summary
End-user system Direct manipulation Constraints not visible to user Changes/strategies expressed via interface
Complex scheduling problem Real-life, not pure problem Interaction/conflicts between constraints Incremental expression with constraints
Development effort (250 days) Integration Data base reporting Graphical interface Problem solver
49
The CHIP system: Constraints and ...
CHIP
XGIPQUIC
CHIP
Application
EMC/CLIC CHIP++
Application
Objects
Solvers
o b je c ts
lo ad sa ve
io db lis t g an tt d ia gram
cre a te set g e t
p an e l
d a ta m od e l
50
Behind the scene
CHIP kernel 175000 lines Prolog 15000 Core Constraints 20000 Global Constraints 140000
Interfaces 5000 lines CLIC EMC QUIC
XGIP graphics 20000 lines
Graphics libraries 17000 lines
51
A typical decision support
application
o b je c ts
lo ad s a ve
io db lis t g an tt d ia g ram
c re a te s e t g e t
p an e l
d a ta m od e l
dB
GUI
LibrariesReporting
Solver
DATA
52
Application framework
Building blocks - data management and GUI description, upload, download, windows, Gantt chart, lists, diagrams,
panels
Built on top of comprehensive data model single point of reference, maintenance, extensions
General enough for different application domains manufacturing, transport, chemical, human resources
Obvious benefits code size, application quality, development speed, decreased
maintenance, etc.
53
Data model
o b je c ts
lo ad sa ve
io db lis t g an tt d ia g ram
c re a te se t g e t
p an e l
d a ta m od e l
Single point of reference
Object model expressed in CHIP++
Meta program generates dB model, hooks to GUI
Provides I/O to save and load object model
54
Needs of an industrial system
Lines of code for a live application
Development speed, tools, risk
Integration
User interface
Solver a must
db/integration46%
library14%
solver9%
static6%
other6%
graphics19%
55
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
04/19/23 56
The Future: Constraint Application Generators
CHIP Factory
57
Approach
CHIP Factory
Program generator for C++
CHIP constraint library
Generates (complete)
application from
specification data model user interface data base solver
58
Problem Description
Example application from LISCOS Project (BASF)
Two stage, continuous process scheduling problem
First stage production intermediate products (10) batch based process campaign based schedule setup times/costs on one line
Intermediate product storage producer/consumer constraints
Second stage production finished products (100) machine choice, machine restrictions variable production rates on machines
59
Problem Description (2)
60
Object Model
MachineChosen
DeletedItemdbKey : intclassName : atomclassKey : int
WarningdbKey : intattribute : atomexplanation : atomreference : atom
MachinedbKey : intdescription : atomseqNr : intnr : intTask
dbKey : intstart : dateend : dateduration : timestartVar : dvarendVar : dvardurationVar : dvar
resource
MachineChoicenrMachines : intparallel : int
DisjMachine
DisjTaskqty : int
IntermediateSetupdbKey : intvalue : int
MachineChoiceTaskresourceVar : dvarqty : int
ProducerConsumer
IntermediateProductdbKey : intbatchSize : intcolor : colordescription : atominitialStock : intspeed : int
from
to
SpeeddbKey : intvalue : time
FinishedProductdbKey : intcolor : colordescription : atominitialStock : int
61
MachineChosen
DeletedItemdbKey : intclassName : atomclassKey : int
WarningdbKey : intattribute : atomexplanation : atomreference : atom
MachinedbKey : intdescription : atomseqNr : intnr : intTask
dbKey : intstart : dateend : dateduration : timestartVar : dvarendVar : dvardurationVar : dvar
resource
MachineChoicenrMachines : intparallel : int
DisjMachine
DisjTaskqty : int
IntermediateSetupdbKey : intvalue : int
MachineChoiceTaskresourceVar : dvarqty : int
ProducerConsumer
IntermediateProductdbKey : intbatchSize : intcolor : colordescription : atominitialStock : intspeed : int
from
to
SpeeddbKey : intvalue : time
FinishedProductdbKey : intcolor : colordescription : atominitialStock : int
GUI Design
list
chart
gantt
62
Constraint Model
DisjTask constraints
MachineChoiceTask constraints
DisjMachine resource constraint
Machine choice resource constraint
Producer/Consumer constraint
63
DisjTask constraints
post(end_var == start_var + duration_var)
post(duration_var == solver.convertDurationToDomain(duration))
64
MachineChoice constraint
diffn_entries(entries);
forall(task,machine_choice_task,
entries.add(task.start_var,task.resource_var,task.duration_var,1)
);
diffn_post(entries)
65
Finished Application
66
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
67
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