Download Planning and Scheduling - Automated Planning - Lecture Slides and more Slides Computer Science in PDF only on Docsity!
CMSC 722, AI Planning
Planning and Scheduling
Scheduling
• Given:
- actions to perform
- set of resources to use
- time constraints
- e.g., the ones computed by the algorithms in Chapter 14
• Objective:
- allocate times and resources to the actions
• What is a resource?
- Something needed to carry out the action
- Usually represented as a numeric quantity
- Actions modify it in a relative way
- Several concurrent actions may use the same resource
Scheduling Problem
• Scheduling problem
– set of resources and their future availability
– actions and their resource requirements
– constraints
– cost function
• Schedule
– allocations of resources and start times to actions
- must meet the constraints and resource requirements
Actions
• Action a
- resource requirements
- which resources, what quantities
- usually, upper and lower bounds on start and end times
- Start time s ( a ) ∈ [ s (^) min ( a ) ,smax ( a )]
- End time e ( a ) ∈ [ emin ( a ) ,emax ( a )]
• Non-preemptive action: cannot be interrupted
- Duration d ( a ) = e ( a ) – s ( a )
• Preemptive action: can interrupt and resume
- Duration d ( a ) = ∑ (^) i ∈ I d (^) i ( a ) ≤ e ( a ) – s ( a )
- can have constraints on the intervals
Consumable Resources
• A consumable resource is used up (or in some
cases produced) by an action
– e.g., fuel
• Like before, we have total capacity Q i and
current level z i ( t )
• If action requires quantity q of r i
– Decrease zi by q at time s ( a )
– Don’t increase zi at time e ( a )
- An action’s resource requirement is a conjunct
of assertions
- consume( a,rj,q (^) j ) & …
- or a disjunct if there are alternatives
- consume( a,rj,q (^) j ) v …
- z (^) i is called the “resource profile” for r (^) i
Costs
• may be fixed
• may be a function of quantity and duration
– e.g., a set-up cost to begin some activity,
plus a run-time cost that’s proportional to the
amount of time
• e.g., suppose a follows b
– cost cr ( a,b ) for a
– duration dr ( a,b ), i.e., s( b ) ≥ e ( a ) + dr ( a,b )
- Objective: minimize some function of the various costs and/or end-times
Single-Stage Machine Scheduling
• Single-stage machine scheduling
- each job is a single action, and can be processed on
any machine
- identical parallel machines
- processing time p (^) j is the same regardless of which machine
- thus we can model all m machines as a single resource of
capacity m
- uniform parallel machines
- machine i has speed( i ); time for j is p (^) j /speed( i )
- unrelated parallel machines
- different time for each combination of job and machine
Multiple-Stage Scheduling
• Multiple-stage scheduling problems
– job contains several actions
– each requires a particular machine
– flow-shop problems:
- each job j consists of exactly m actions { a (^) j 1 , a (^) j 2 , …, a (^) jm }
- each a (^) ji needs to be done on machine i
- actions must be done in order a (^) j 1 , a (^) j 2 , …, a (^) jm
– open-shop problems
- like flow-shop, but the actions can be done in any order
– job-shop problems (general case)
- constraints on the order of actions, and which machine for each action
Notation
- Standard notation for designating machine scheduling problems: α | β | γ α = type of problem: - P (identical), U (uniform), R (unrelated) parallel machines - F (flow shop), O (open shop), J (job shop) β = job characteristics (deadlines, setup times, precedence constraints), empty if there are no constraints γ = the objective function
- Examples:
- Pm | δ j | Σ jw (^) jej
- m identical parallel machines, deadlines on jobs, minimize weighted completion time
- J | prec | makespan
- job shop with arbitrary number of machines, precedence constrants between jobs, minimize the makespan
Complexity
- Most machine scheduling problems are
NP-hard
- Many polynomial-time reductions
Problem types (α in the α|β|γ notation): P - identical parallel machines U - uniform parallel machines R - unrelated parallel machines F - flow shop O - open shop J - job shop
Reductions for α = type of problem Reductions for γ = the objective function
IP Solvers
- Most IP solvers use depth-first branch-and-bound
- Want a solution u that optimizes an objective function f ( u )
- Node selection is guided by a lower bound function L ( u )
- For every node u , L ( u ) ≤ { f ( v ) : v is a solution in the subtree below u }
- Backtrack if L ( u ) ≥ f ( u ), where _u =_ the best solution seen so far
procedure DFBB global u* ← fail; f* ← ∞ call search( r ), where r is the initial node return ( u,f )
procedure search( u ) if u is a solution and f ( u ) < f* then u* ← u ; f* ← f ( u ) else if u has no unvisited children or L ( u ) ≥ f* then do nothing else call search( v ), where v = argmin{ L ( v ) : v is a not-yet-visited child of u }
L ( u ) very similar to A*’s heuristic function f ( u ) = g ( u ) + h ( u )
Main difference: L isn’t broken into f ’s two components g and h
A* can be expressed as a best-first branch-and- bound procedure
Planning as Scheduling
- Some planning problems can be modeled as machine-scheduling problems
- Example: modified version of DWR
- m identical robots, several distinct locations
- job: container-transportation( c,l,l' )
- go to l , load c , go to l' , unload c
- All four tasks to be done by the same robot (which can be any robot)
- release dates, deadlines, durations
- setup time t (^) ijk if robot i does job j after performing job k
- minimize weighted completion time
- Can generalize the example to allow cranes for loading/unloading, and arrangement of containers into piles
- Problem : the machine-scheduling model can’t handle the part I said to ignore
- Can specify a specific robot ri for each job j (^) i , but can’t leave it unspecified
Let’s ignore this for a moment