Post on 30-Mar-2015
1-1
Constraint-based Scheduling
Claude Le Pape
1-2
Outline
• Introduction• Scheduling constraints• Non-preemptive scheduling
– Temporal constraints
– Resource constraints
– Problem-solving examples
• Preemptive scheduling• Conclusion (applications)
1-3
Scheduling problems
"Scheduling is the allocation of resources over time to perform a collection of tasks" [Baker 74]
– Pure scheduling problems: assignment of start and end times to activities (each activity requires given resources with given capacities)
– Pure resource allocation problems: assignment of resources to activities (the start and end times of each activity are given)
– Joint scheduling and resource allocation problems: assignment of resources and start and end times to activities
1-4
Scheduling problems
• Transportation– Traffic scheduling and control (aircrafts, buses, trains, trucks)
– Loading and unloading (aircrafts, ships, trucks)
– Crew rostering
• Production and maintenance
• Manpower planning and timetabling (shifts, courses, exams)
• Project or mission scheduling
• Network planning and routing
• Computer or printer job scheduling
• Mixture planning, rack configuration, textile cutting, ...
1-5
Variety of scheduling problems
• Activities
• Resources
• Constraints
• Optimization criteria
• Problem size
• Time available to make a decision
1-6
Activities
• Interval (block) activities
• Splittable activities (with interruption cost?)
A
time
A
time
A A A
1-7
Resources
• Unary resources– one person
– one machine
• Discrete resources– a group of people with the same capabilities
• State resources– an oven with different possible temperatures
• Energetic resources– a limited number of human-days each week
1-8
Constraints
• Temporal constraints– Fixed or variable durations
– Precedences
– Minimal and maximal delays
• Resource constraints– Fixed capacity
– Variable capacity (time versus capacity tradeoffs)
– Variable capacity over time
• Specific constraints
1-9
Optimization criteria
• No optimization criterion• A well-defined criterion
– Project makespan
– Number of activities performed within given delays
– Maximal or average tardiness or earliness
– Peak or average resource utilization
• A combination of well-defined criteria• Preferences (soft constraints)• Optimization versus robustness
1-10
Problem sizenumber
of resources
numberof activities
1000
100
10
11 10 100 1000 10000
unary resourcesdiscrete resourcesseveral types of resources
1-11
Problem sizenumber
of resources
numberof activities
1000
100
10
11 10 100 1000 10000
production and maintenancenetwork routing and traffic controlother applications
1-12
Suitable response time
• Reactive train traffic control: two seconds• Predictive production and maintenance
scheduling: minutes to hours• Reactive production and maintenance
scheduling: seconds• Predictive timetabling: minutes to hours• Reactive computer or printer job scheduling:
small fraction of the average job duration
1-13
Constraint programming
Problemdefinition
Decision-making(and retracting)
Constraintpropagation
Problem specificationor partial solution interms of constraints
Initial constraintsDynamic changes
Deduced constraintsContradictions
New constraints(decisions)
1-14
Constraint programming
• Explicit problem definition
• Separation between problem definition and problem solving
• Systematic deduction of the consequences of made decisions (constraint propagation)
Partial constraint propagation development of heuristic search algorithms to generate and optimize solutions
• Incremental constraint propagation (with fixpoint semantics)
• Localized definition of the constraint propagation process (each constraint propagates independently of other constraints)
1-15
Incrementality principle (1)
Masonry (7)
Carpentry (3)
Roofing (1)
Windows (1) Facade (2) Garden (1) Painting (2)
Moving (1)
Plumbing (8) Ceilings (3)
1-16
Incrementality principle (2)
Masonry
Plumbing
Carpentry
R.
Ceilings
Facade
W.
G.
Paint.
M.
0 5 10 15 20
1-17
Incrementality principle (3)
• "Plumber" "Roofer"
• Solution: Order "Plumbing" and "Roofing"
• Heuristic choice
For example, "Plumbing" before "Roofing"
1-18
Incrementality principle (4)
Masonry
Plumbing
Carpentry
R.
Ceilings
Facade
W.
G.
Paint.
0 5 10 15 20
M.
1-19
Incrementality principle (5)
Masonry
Plumbing
Carpentry
R.
Ceilings
Facade
W.
G.
Paint.
0 5 10 15 20
M.
1-20
Incrementality principle (6)
Masonry
Plumbing
Carpentry
R.
Ceilings
Facade
W.
G.
Paint.
M.
0 5 10 15 20
1-21
Incrementality principle (7)
Masonry
Plumbing
Carpentry
R.
Ceilings
Facade
W.
G.
Paint.
0 5 10 15 20
M.
1-22
Incrementality principle (8)
Constraint propagation consists in
incrementally
updating characteristics of a partial problem solution
when an additional constraint is added
These characteristics may be:
– indicators of contradictions
– domains of variables (relational propagation)
– the overall set of constraints (logic/algebraic propagation)
1-23
Incrementality principle (9)
Particular case: arc-consistency
A constraint propagation technique enforces arc-consistency if and only if when propagation stops the following statement holds:
for every constraint c(v1 ... vn)
for every variable vi
for every value vali in the domain of vi
there are values val1 ... vali1 vali1 ... valn
in the domains of v1 ... vi1 vi1 ... vn
such that val1 ... vali1 vali vali1 ... valn satisfy c
1-24
Incrementality principle (10)
Non-monotonic constraint propagation consists in
incrementally
updating characteristics of a partial problem solution
when a constraint is added or retracted
Non-monotonic constraint propagation implies the cancellation (hence the identification) of the consequences of the retracted constraints
Non-monotonic constraint propagation is not used as much as "monotonic" constraint propagation (for complexity reasons)
1-25
Locality principle (1)
• Each constraint (or constraint type) "includes" all the information necessary to enable its propagation and, in particular, to determine whether it is satisfied or not as soon as all its variables are instantiated
• The constraint propagation methods associated with a constraint (or constraint type) are a priori independent of the methods associated with other constraints
1-26
Locality principle (2)
• Example: temporal constraints and resource constraints– User: "Plumber" "Roofer"
– User: "Moving" must end before 20
– Temporal constraints: "Plumbing" must end before 17
– Disjunctive resource constraint: "Plumbing" must precede "Roofing"
– Temporal constraints: "Moving" cannot end before 19
1-27
Constraint programming
• Artificial Intelligence– Declarative programming (problem definition)
– Generic inference mechanisms (constraint propagation)
– Generic search techniques (problem solving)
• Operations Research– Linear programming is "declarative"
– Efficient algorithms for deducing solution characteristics
– Efficient search techniques
• Software Engineering– Incremental and local processes
1-28
Constraint programming
Precision Flexibility
Efficiciency Extensibility
1-29
Precision
• Explicit representation of the overall set of constraints
• Guarantee of constraint satisfaction
Softwarepackage
Specificdevelopment
Use of a constraintprogramming tool
Guarantee of constraint satisfaction BUTlimitation to the constraints considered in the package.
No limitation BUTguarantee of constraint satisfaction to build totally.
Guarantee of satisfaction of the predefined constraints.Possibility of defining specific constraints.
1-30
Precision (example)
• An automatic cart places the batches of products on the waiting areas ( )
• Batches are also evacuated through the waiting areas
• A waiting area contains at most one batch at a time
• There are only two waiting areas per machine
Machine Machine Machine
1-31
Efficiency
• Generation of a "good" solution in a reasonable amount of time
• Response time versus solution quality tradeoffs which correspond to the needs of the users
Softwarepackage
Specificdevelopment
Use of a constraintprogramming tool
CPU time not controlled (although generally correct).Solution quality not controlled.
Compromises made by the development team.Heavy (often omitted) code optimization task.
Compromises made by the development team.Highly optimized predefined constraints and basic mechanisms.
1-32
• Scheduling of 48n activities on 17n resources of 5 different types (2 to 7 resources per activity)
Algorithm 1 Algorithm 2 Algorithm 3 Combination
Efficiency (example)
solution cost
CPU.001 1 1000
solution cost
CPU.001 1 1000
1-33
Flexibility
• Using (combining) different methods to solve different problems (or subproblems)
• Incrementally modifying a problem
Softwarepackage
Specificdevelopment
Use of a constraintprogramming tool
Some flexibility may exist BUTlimited to cases considered by the software designer.
Points of flexibility chosen with respect to actual needs.More or less complex implementation process.
Exploitation of the separation between "problem definition,""constraint propagation," and "decision-making."
1-34
Flexibility (example)
Importance ofbottleneck resource
Importance ofbottleneck resource
Quality of a resource-basedproblem decomposition
Quality of an order-basedproblem decomposition
Importance ofbottleneck resource
Quality of an "opportunistic"problem decomposition
1-35
Extensibility
• Extending and modifying an application when the context in which it is used changes
• Adapting an application to a new problem
Softwarepackage
Specificdevelopment
Use of a constraintprogramming tool
Extensibility is limited.Very often no way of extending the system at all.
Extensible as the source code is available BUThigh extension cost (depending on the source code).
Exploitation of the separation between "problem definition,""constraint propagation," and "decision-making."
1-36
Extensibility (example)
• Allocation of locomotives to trainsConstraints Diesel
Constraints Electric
Constraints TGV
• "Electric to Diesel": immediate adaptation (one additional specific constraint)
• "Electric to TGV": 3 man-months
1-37
Limits
• Not a miracleNP-hard problems remain NP-hard
• Not an immediate solutionConstraint programming is a method for which tools are available
Developing and testing software remains necessary
• Not a universally useful methodMany problems do not necessitate constraint programming (e.g., critical path computation) or are such that their resolution cannot benefit from the use of constraint-based techniques