Propagation of resource constraints for scheduling

Download Report

Transcript Propagation of resource constraints for scheduling

Constraint-based Scheduling
Claude Le Pape
1-1
Outline
• Introduction
• Scheduling constraints
• Non-preemptive scheduling
– Temporal constraints
– Resource constraints
– Problem-solving examples
• Preemptive scheduling
• Conclusion (applications)
1-2
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-3
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-4
Variety of scheduling problems
•
•
•
•
•
•
Activities
Resources
Constraints
Optimization criteria
Problem size
Time available to make a decision
1-5
Activities
• Interval (block) activities
A
time
• Splittable activities (with interruption cost?)
A
A
A
A
time
1-6
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-7
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-8
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-9
Problem size
number
of resources
unary resources
discrete resources
several types of resources
1000
100
10
1
1
10
100
1000
10000
number
of activities
1-10
Problem size
number
of resources
production and maintenance
network routing and traffic control
other applications
1000
100
10
1
1
10
100
1000
10000
number
of activities
1-11
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-12
Constraint programming
Problem
definition
New constraints
(decisions)
Decision-making
(and retracting)
Problem specification
or partial solution in
terms of constraints
Initial constraints
Dynamic changes
Deduced constraints
Contradictions
Constraint
propagation
1-13
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-14
Incrementality principle (1)
Masonry (7)
Carpentry (3)
Windows (1)
Roofing (1)
Plumbing (8)
Ceilings (3)
Facade (2)
Garden (1)
Painting (2)
Moving (1)
1-15
Incrementality principle (2)
0
5
10
15
20
Masonry
Plumbing
Carpentry
R.
W.
Ceilings
Facade
G.
Paint.
M.
1-16
Incrementality principle (3)
• "Plumber" = "Roofer"
• Solution: Order "Plumbing" and "Roofing"
• Heuristic choice
For example, "Plumbing" before "Roofing"
1-17
Incrementality principle (4)
0
5
10
15
20
Masonry
Plumbing
Carpentry
R.
W.
Ceilings
Facade
G.
Paint.
M.
1-18
Incrementality principle (5)
0
5
10
15
20
Masonry
Plumbing
Carpentry
R.
W.
Ceilings
Facade
G.
Paint.
M.
1-19
Incrementality principle (6)
0
5
10
15
20
Masonry
Plumbing
Carpentry
R.
W.
Ceilings
Facade
G.
Paint.
M.
1-20
Incrementality principle (7)
0
5
10
15
20
Masonry
Plumbing
Carpentry
R.
W.
Ceilings
Facade
G.
Paint.
M.
1-21
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-22
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 ... vali-1 vali+1 ... valn
in the domains of v1 ... vi-1 vi+1 ... vn
such that val1 ... vali-1 vali vali+1 ... valn satisfy c
1-23
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-24
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-25
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-26
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-27
Constraint programming
Precision
Flexibility
Efficiciency
Extensibility
1-28
Precision
• Explicit representation of the overall set of
constraints
• Guarantee of constraint satisfaction
Software
package
Specific
development
Use of a constraint
programming tool
Guarantee of constraint satisfaction BUT
limitation to the constraints considered in the package.
No limitation BUT
guarantee of constraint satisfaction to build totally.
Guarantee of satisfaction of the predefined constraints.
Possibility of defining specific constraints.
1-29
Precision (example)
Machine
Machine
Machine
• 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
1-30
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
Software
package
Specific
development
Use of a constraint
programming 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-31
Efficiency (example)
• Scheduling of 48n activities on 17n resources of 5 different
types (2 to 7 resources per activity)
solution cost
.001
1
Algorithm 1
solution cost
1000 CPU
Algorithm 2
.001
Algorithm 3
1
1000 CPU
Combination
1-32
Flexibility
• Using (combining) different methods to solve
different problems (or subproblems)
• Incrementally modifying a problem
Software
package
Specific
development
Use of a constraint
programming tool
Some flexibility may exist BUT
limited 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-33
Flexibility (example)
Quality of a resource-based
problem decomposition
Quality of an order-based
problem decomposition
Importance of
bottleneck resource
Importance of
bottleneck resource
Quality of an "opportunistic"
problem decomposition
Importance of
bottleneck resource
1-34
Extensibility
• Extending and modifying an application when the
context in which it is used changes
• Adapting an application to a new problem
Software
package
Specific
development
Use of a constraint
programming tool
Extensibility is limited.
Very often no way of extending the system at all.
Extensible as the source code is available BUT
high extension cost (depending on the source code).
Exploitation of the separation between "problem definition,"
"constraint propagation," and "decision-making."
1-35
Extensibility (example)
• Allocation of locomotives to trains
Constraints Diesel
Constraints Electric
Constraints TGV
• "Electric to Diesel": immediate adaptation
(one additional specific constraint)
• "Electric to TGV": 3 man-months
1-36
Limits
• Not a miracle
NP-hard problems remain NP-hard
• Not an immediate solution
Constraint programming is a method for which tools are available
Developing and testing software remains necessary
• Not a universally useful method
Many 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
1-37