Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity...

66
Finite Capacity Scheduling 6.834J, 16.412J

Transcript of Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity...

Page 1: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Finite Capacity Scheduling6.834J, 16.412J

Page 2: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Overview of Presentation

• What is Finite Capacity Scheduling?

• Types of Scheduling Problems

• Background and History of Work

• Representation of Schedules

• Representation of Scheduling Problems

• Solution Algorithms

• Summary

Page 3: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

What is Finite Capacity Scheduling?

• Informal and Partial Definitions– Determining the best sequence of tasks on a resource

– Optimal assignment of limited resources to tasks to fulfill a set of orders

– Elimination of factory bottlenecks

• Formal Definition– The allocation of resources over time to perform a set

of tasks • such that task precedence constraints and resource capacity

constraints are not violated, and overall deadline goals are met to the best extent possible

Page 4: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Example Schedule• Gantt chart

F1

F2

F3

T1

T2

T3

T4

T5

T6

Time

Resources

Page 5: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Types of Scheduling Problems

• Energy

• Job Shop

• Batch Process

• Discrete Manufacturing

• Servicing of Complex Equipment

• Scheduling of a Unique Resource

• Military Logistics

Page 6: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Energy Scheduling• Electrical utility generator scheduling to meet anticipated

demand

• Ex. – Utility with 3 Generators

Generator 1 2 3

Capacity

(kw)120 120 350

Hourly Cost

($/h)10 10 10

Incremental Cost ($/kwh)

0.20 0.30 0.40

Page 7: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Energy Scheduling (cont.)

• Demand Profile

Time

KW

1 2 3 4

100

200

300

Page 8: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Energy Scheduling (cont.)

• Best Schedule:

Hour 1 2 3 4

Generator 1 100 120 120 100

Generator 2 0 80 120 0

Generator 3 0 0 60 0

Page 9: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Let if generator i is on during time j, 0 otherwise

be the energy generated by generator i during time j Cost can then be expressed as

From the previous schedule, non-zero values of B and E are:

So cost = 70 + 88 + 60 + 24 = 242

1ijB

ijE

4

13

4

12

4

11

4

13

4

12

4

11

40.030.020.0

101010

jj

jj

jj

jj

jj

jj

EEE

BBBCost

60

12080

100120120100

1

1

1

33

2322

14131211

33

2322

14131211

E

EE

EEEE

B

BB

BBBB

Page 10: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Constraints for this problem can be expressed as

Where is demand at time j, and is the capacity of generator i.

Note how this forces Eij to be 0 if Bij is.

This, combined with the constraint that the B variables must be binary, and the previously defined cost function, yields an optimization problem with discrete and continuous constraints.

Such problems are often solved by Mixed Integer Linear Programming algorithms (more on this later).

jD

iijij

jjjj

CapBE

DEEE

321

iCap

Page 11: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Variations on Problem

• Suppose utility has 100 kwh energy storage device (battery that has no hourly or incremental cost)– Could run generator 2 during 1st hour to charge battery

– Could then discharge battery to meet demand in 3rd hour

– Eliminates need to use generator 3

• Suppose another consumer would like to buy energy– New consumer has their own demand profile

– Utility must evaluate whether it is profitable to sell to this new customer

• This is a function of base demand profile, consumer’s demand profile,

generation costs, and what the new consumer is willing to pay

- Suppose generator 3 has high hourly cost but low energy cost- It may make sense to run it and shut off generators 1 and 2

Page 12: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Variations on Problem – Co-generation

• Co-generation introduces a new set of complex considerations

• Ex. – Refinery that uses waste heat from process to make steam to generate electricity

• Refinery may schedule production to simultaneously meet production goals and demand for electricity, thus maximizing profit – Two kinds of demand

• Refinery’s main products (gasoline of various grades, etc.)

• Electricity (demand profile as shown previously)

• Also complicated by the fact that electricity prices vary based on demand, and on time of day

• Contracts between factories, utilities, and customers can be extremely complicated

Page 13: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Job Shop Scheduling• Schedule n jobs on m machines

• Each job requires processing on each machine in a particular order

• This order differs from one job to another

• Often formulated as constraint satisfaction problem with binary temporal constraints among the mn tasks

• Eliminating bottleneck resources is an important goal

Page 14: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Batch Process Scheduling• Tasks have “size” that is a continuous and/or

discrete function of the amount of material to be produced to fulfill an order

• Task size can affect task duration, resource requirements

• Resource utilization represented with a combination of discrete and continuous variables

• Often, and important goal is to find ways to combine similar tasks into larger “batches” in order to minimize changeover costs

Page 15: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Example – Beer Production

• After brewing and aging, beer must be filtered, prior to packaging.

Filter 1

Filter 2

HoldingTank

1

Fromagingtanks

HoldingTank

2

HoldingTank

3 HoldingTank

4

ToPackaging

Page 16: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Discrete Manufacturing Scheduling

• Semiconductor

• Auto assembly

• Heavy equipment

• Aircraft assembly

• Electronic parts assembly

Page 17: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Discrete Manufacturing Scheduling (cont.)

- Characteristics- Similar, in some ways, to job shop, and to batch

process scheduling- Process plan instantiated based on order

- Process plans for similar types of orders are similar

- Fewer continuous variables and constraints- Task sizes are discrete functions of order

- Ex. – a car needs 4 tires

- Resource allocations are typically binary- Resource is utilized or not

- Resources typically allocated to tasks for individual orders

- Typically, no batching of tasks

Page 18: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Scheduling Service of Complex Equipment

• Ex. – Space Shuttle Ground Processing

• Approximately 40,000 hours of technician labor between flights.

Page 19: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Space Shuttle Service (cont.)

• About 50% same for each flight. Rest is function of – payloads,

– maintenance based on age of components

– orbiter modifications

• Very dynamic environment– Arrival date subject to change (and affected by weather)

– Resource requirements – parts, supplies, people

– State (configuration) of system being repaired is important• State constraints (requirements and effects), very important

• Use of changeover tasks to get system into correct state

Page 20: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Scheduling of a Unique Resource• Ex. – Hubble Telescope

Page 21: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Scheduling of Hubble Telescope (cont.)

• 10,000 to 30,000 observations scheduled per year• Primary resource constraint is available observing

time– Affected by orbital position

– Required orientation to keep sunlight on solar panels

• Many constraints periodic• Disruptions

– Targets of opportunity (new supernova)

– Spacecraft anomalies

– Changes in observing programs

Page 22: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Military Logistics

• Transportation of troops and supplies

• Resources to be scheduled are transport vessels and cargo planes– Groups of troops and supplies represent tasks

• Resource capacity constraints significant

• Deadline constraints significant

• Precedence constraints significant– Equipment must be delivered in appropriate

sequence

Page 23: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Background of Work on Scheduling(a representative, but not exhaustive list)

• MRP (Material Requirements Planning), MRP II (1970’s)– Demand for end-products expanded into time-phased requirements for

parts

– Timing based on operation leadtimes

– No accounting of resource loading

– Schedules often un-realistic

• Mark Fox, CMU, ISIS (1980’s)– Each order scheduled one at a time

– Constructive approach, incrementally extends partial schedule solution until complete

– Simple best-first search with backtracking

– Formulation as CSP, hard and soft constraints, continuous and discrete

– Some constraint propagation (forward chaining) capability

Page 24: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Background of Work on Scheduling (cont.)

• Monte Zweben, NASA, Gerry (1990’s)– Iterative repair algorithm – Modifies complete schedule to repair constraints, or

to make more optimal– Hill-climbing, search states are complete solutions

• Pantelides, Imperial College (1990’s)– Chemical Process Scheduling– RTN, MILP algorithm– Discrete time formulation – Branch and bound, branch and cut

Page 25: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Areas of Work Related to Scheduling• Assignment Problem

– Assign n tasks to n resources (no time rep.)– Specialized algorithm solves this efficiently

• Transportation Problem– Transfer material between nodes in a graph

• Traveling Salesman Problem– Resource “visits” n tasks (optimal sequencing of tasks on

a resource)

• Graph theory, flow networks (used in TSP)• Long-Range Planning

– using Dynamic Programming

• Combinatoric Optimization, CSP, A* search, MILP

Page 26: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Representation of Schedules• Task

– Start time– Finish time– Duration– Resource assignments

• Resource– Renewable (equipment for example)– Non-renewable (material or product, for example)

• Useful to think of task as consuming one set of resources, and producing another set– For equipment, the task “consumes” the resource at the

start time, and “produces” it (makes it available again) at the finish time.

Page 27: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Representation of Schedules (cont.)

• Attributes of materials (non-renewable) resources - amount and state– Amount of flour, number of loaves of bread – related to task size

– State – temperature of bread, freshness

• Attributes of equipment (renewable) resources – state– Oven at input is clean (required state), oven at output is dirty (effect)

• Cleaning oven is “changeover” task

– Baker at output is tired (taking a knap might be changeover)

• Attributes of tasks related to those of resources

BakingTask

Bread BakingTask and Resources

Dough

CookingOil

Oven

Baker

Bread

Oven

Baker

Page 28: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Representation of Schedules:Discrete vs. Continuous Time Representations

• Discrete– Scheduling horizon divided into discrete, equal intervals

• Task start, finish times expressed in terms of these increments– Advantageous for certain scheduling algorithms

• Easy to check for resource capacity violations– Disadvantage is that if fine time granularity over longer scheduling

horizon is required, then many intervals• Problem size becomes un-manageable

• Continuous– Task start, finish times expressed as real numbers

– Smaller number of variables • Discrete event vs. discrete time

– Disadvantage is that checking resource capacity violations is more complicated

• Rules out use of certain scheduling algorithms

Page 29: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Representation of SchedulesGantt Chart

F1

F2

F3

T1

T2

T3

T4

T5

T6

Time

Resources

Page 30: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Representation of Scheduling Problems• Resource-Operation Network (RON)

– Inspired by Imperial College RTN

• Consists of Operations and Resource Requirements– Operation

• Class of task• Duration may be constant, or may be function of other things• Other attributes (amount, type of material to be produced)

– Resource Requirement• Renewable and non-renewable resources• Incorporates notion of state (of a material or a resource)

• Task is an instantiation of an operation• Resource assignment is an instantiation of a

resource requirement

Page 31: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Representation of Scheduling Problems (cont.)

- Note similarity to schedule representation-Attributes of operations and resource requirements similar to attributes of tasks and resources

BakingTask

Bread Baking Operationsand Resource Requirements

Dough

CookingOil

Oven

Baker

Bread

Oven

Baker

KneadingTask

Flour

Water

Baker

CleaningTask

Page 32: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Representation of Scheduling Problems:Constraints

• Resource requirements, Operations have attributes– Some general (like duration, start-time, etc.)

– Some problem specific (state of a particular resource type)

• Attributes can have discrete or continuous values

• Combination of algebraic and logical constraints used to constrain values of attributes– Kneading.finish_time < Baking.start_time

– Baking.OvenInput.Status = clean

– Baking.Dough.amount = f(Baking.size)

• RON architecture is general enough to support just about any kind of constraint (algebraic, logical, even functions)– However, there are a number of important basic types of constraints that

are often used in scheduling

Page 33: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Representation of Scheduling Problems:Common Constraint Types

• Constraints associated with resources– Resource utilization (how much of a resource a task needs)– Resource capacity (resource utilization should not exceed this)– Resource state

• Task may require resource to be in particular state at beginning of task• Task may leave resource in particular state at end of task (effect)• Motivation for changeover tasks

– Resource availability (calendar)• Resource (labor for example) may not be available on weekends

• Constraints associated with tasks– Duration (may be constant, or may be function of task size)– Start, finish (related by duration)– Precedence (kneading before baking)

• Usually not necessary when using RON formulation (falls out)

– Due dates (ultimately, the reason for doing scheduling)

Page 34: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Resource Utilization Constraints• Operation usually determines amount of resource

required, and amount produced– May be simple constant:

• Baking.Oven_Input.amount = 1 (need one oven)

• Baking.Oven_Output.amount = 1 (oven not consumed by process)

– May be integer function of task size• Baking.Size = Baking.Break.Loaves (task size = number of loaves)

• Baking.Flour.amount = 12 x Baking.Size

– May be continuous function of task size• HoldingTank.level = 50 x Filtering.Size

– May even be a complex, non-linear function• Lubricant.amount = f(Drilling.Size)

Page 35: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Resource Capacity Constraints• Resource utilization should not exceed maximum

capacity for a resource• Resource utilization becomes function of time over

scheduling horizon

Time

% Utilization

1 2 3 4

50

100

150

5 6

Page 36: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Resource State Constraints• Constraint on state of input resource requirement

– Analogous to requirement part of planning operation (Graphplan, etc.)– Baking.Oven_Input.status = clean

• Constraint on state of output resource requirement– Analogous to effects part of planning operation– Baking.Oven_Output.status = dirty

• Changeover operation used to restore resource to required state– Cleaning operation converts dirty oven to clean one

• State requirements, changeover operations, often the key issue in generating good schedule– Reason: changeover operations take time (setup time)– Goal is often to minimize changeovers– This can be achieved by batching similar tasks– There is a limit to this, however, imposed by limits of inventory (resource

capacity constraints)

Page 37: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Soft Constraints and Cost• It is often advantageous to think of scheduling as a constrained

(or even un-constrained) optimization problem, rather than a constraint satisfaction problem– Analogous to notion of Lagrange multipliers in non-linear constrained

optimization

• Allow some constraints to be relaxed (make them soft)– However, relaxation has a cost penalty– Relaxation of deadline constraint results in lateness penalty– Relaxation of resource capacity constraint results in overtime pay

requirement

• Production costs usually directly associated with resource utilization

• Thus, cost function is sum of– Resource utilization costs– Constraint relaxation penalties

Page 38: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Process Plan Instantiation

• Instantiate tasks for process plan (operations) for each order

• Ex. 3 orders for bread

Order Amount Due Date

1 3 loaves Mon.

2 5 loaves Tues.

3 1 loaf Wed.

Page 39: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Instantiated Tasks (Based on Process Plan)

Task Kneading1 Kneading2 Kneading3 Baking1 Baking2 Baking3

Size 3 5 1 3 5 1

Also, Cleaning1, Cleaning2, and Cleaning3(size not an issue for these)

Page 40: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Process Plan Instantiation (cont.)

• Initial resource assignment based on resource requirements using very simple dispatch heuristics– Sequence tasks on resource based on order

Baker Knead1

Clean1

Bake1

Resources

Oven Bake1

Knead2

Clean2

Bake2

Bake2

Mon. Tues.

Page 41: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Process Plan Instantiation (cont.)

• This actually is not a bad schedule in some circumstances– Probably is a good schedule for this example

• On the other hand, if the baker doesn’t care about freshness, and wants to take Tues. off– Batch orders together to improve efficiency– Requires inventory capacity

• Refrigerated storage space

• Tolerance to reduction in quality (quality is a state variable that decays over time)

Page 42: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Solution of Scheduling Problems• Unlike representation, which is relatively

universal, solution algorithm is problem-dependent

• Most real-world problems also require heuristics, specialized for the particular type of problem

Page 43: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Solution Algorithms• Dispatch Algorithms

• MILP– Relation to A*, constructive constraint-based

• Constructive Constraint-Based

• Iterative Repair– Simulated Annealing– How A* heuristics can be used here (relaxation

of deadline constraints)

• Genetic Algorithms

Page 44: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Dispatch Algorithms• Process plan instantiated (as described

previously)

• Tasks put into queues, one for each order– (Preserves task precedence constraints)

Kneading1Order 1 Queue Baking1 Cleaning1

Kneading2Order 2 Queue Baking2 Cleaning2

Kneading3Order 3 Queue Baking3 Cleaning3

Page 45: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Dispatch Algorithms (cont.)• Tasks released one at a time from queues

– Assigned to first available resource

• Which queue is popped depends on task priorities– Queue with highest priority task at top gets

popped

• Task priority based on variety of factors– Mainly order importance and urgency

• Apex system is a dispatch system– Flight controller assistant, described by Rob

Kochman

Page 46: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Dispatch Algorithms (cont.)• Advantages

– Simple to implement– Can easily handle changing requirements by updating

priorities

• Disadvantages– When task is popped, it is assigned to first available

resource– If none available, it just waits, and nothing further can

be done• Thus, susceptible to bottlenecks

– Doesn’t really set schedule times• Can’t guarantee when things will get done

– No look-ahead, so no optimization– No capability for JIT

• Tasks “shifted to the left”

Page 47: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Dispatch Algorithms (cont.)• However

– Much, if not most, real-world scheduling is done in this way

– Manual scheduling is often done in this way

Page 48: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

MILP (Mixed Integer Linear Programming)

• Used for energy scheduling

• Chemical process scheduling– Pantelides, et. al., Imperial College

• Sometimes used in discrete manufacturing– Pekny, Miller, Traveling Salesman Problems

• For scheduling, requires discrete time formulation

Page 49: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

MILP Basics• Constraints represented as linear equalities and

inequalities

• A is constant matrix, b is constant vector, x is vector of variables– X vector has lower and upper bounds

– X consists of real and integer variables

• Cost represented as weighted sum of x

uxl

bAx

I

Rx

i

iitot xcc

Page 50: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

MILP Basics• Energy scheduling example presented previously

is an example of an MILP

jiijij

jiijij

iijij

ji

ij

ECeBCbC

CapBE

DE

,,

0

Page 51: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

MILP Basics (cont.)• This formulation is relatively easy to solve if x has

just real variables, no integers (if it is an LP)– Simplex algorithm, commercial solvers (CPLEX) can

easily handle problems with > 100,000 variables

• Integer constraint adds significant complexity– Requires search where for each integer variable,

• Pick an integer• Propagate by solving LP• If feasible, go on to next variable and repeat• If not feasible, pick different integer

– Bad news – depth-first search– Good news – there is a very good heuristic to

guide the search

Page 52: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

MILP Basics (cont.)• The linear relaxation often gives good guidance about

what integer values to pick• Ex.

– Suppose that LP relaxation results in value of 7.3 for variable x1, which is constrained to be an integer variable.

– MILP solver tries x1 = 7 as one search branch, and x1 = 8 as the other

• This algorithm is called “branch and bound”• Note that the LP relaxation is a best-case heuristic• Therefore, branch and bound is a kind of A*

search– If the LP relaxation yields a solution that is worse than

the best one found so far, that entire branch of the tree is pruned

Page 53: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

MILP Basics (cont.)• Ex. x1, x2 are integer, other variables real

X1=3

1

Relaxation: x1 = 3.6cost = 5.0

2 5

3 4

X1=4

Relaxation: x2 = 2.1cost = 10.0

Relaxation: x2 = 7.5cost = 20.0

X2=2 X2=3

cost = 14.0

Page 54: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

RTN FormulationLet

if resource i is assigned to task j at time k,

0 otherwise. Suppose task j has duration n. Let

if task j starts at time k, 0 otherwise. Then

Note that if ST is set to integer (1 or 0), all other variables have integer values, even in LP relaxation! Example of “branch and cut”.

Resource capacity constraint is easy to express:

1ijkR

1jkST

1

...1

jkjk

jknijkijkijk

STSLK

nSLKnRRR

1j

ijkR

Page 55: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

RTN Formulation (cont.)Material production is formulated as follows:

here, j refers to tasks that produce material Mi. Then, deadline constraint is simply

(is enough of the material ready at the due time).

Advantages- Rigorous formulation, all constraints propagated

- Easy to try all sorts of what-if scenarios

- Resource capacity constraints, material production easily checkedDisadvantages- Requires discrete-time formulation, so formulation can become large- Formulation tricky

- Important that constraints significantly reduce search space- Should be set up so that relaxation produces integer results- Compilers can mitigate this disadvantage

j

jkjniknik STKMM 1

ikfinali MgoalM

Page 56: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Constructive Constraint-Based- Fox, et. al., ISIS

- Best-first search with backtracking

- Tasks for orders scheduled one at a time

- Incrementally adds to partial schedule at each node in the search

- If infeasibility is reached (constraint violation)- Backtrack to resolve constraint

- Advantages- Relatively simple, can make use of standard algorithms like A*

- Use of A* allows for incorporation of heuristics

- Such heuristics are often used by human schedulers

- Disadvantages- Re-scheduling is difficult

- May not find a complete schedule in the required time

- Changeover constraints, task switching is difficult

- Constraint relaxation is difficult

Page 57: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Constructive Constraint-Based (cont.)- Important disadvantage (often a show-stopper)

- A simple swap of ordering of two tasks on a resource (something that human schedulers often do) may require significant backtracking

- Ex.

- Swapping to eliminate large changeover (asymetric TSP) requires backtracking

- Unravels everything done between order 1 and n

Task for order 1 Large Changeover Task for order n

Page 58: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Iterative Repair- Zweben, et. al., GERRY, Red Pepper Software

- Scheduling of space shuttle ground operations

- Johnston and Minton- Scheduling of Hubble space telescope

- Begin with complete but possibly flawed schedule- Generate initial schedule quickly using simple dispatching

- Iteratively modify to repair constraint violations, and to make more optimal

- Each step in search is a repair step (single modification to complete schedule)- Results in either better or worse schedule

- Hill-climbing (best-first) search

- Searches space of possible complete assignments

Page 59: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Iterative Repair (cont.)- Disadvantage

- May get stuck in local optimum (as with all local search techniques)

- Can be mitigated using simulated annealing approach- Allow repair step that increases cost with some non-zero probability

- Advantages- Inherently provides for rescheduling

- Current schedule is initial (flawed) schedule for new requirements

- Assumes new requirements not that different from old

- Complete schedule available at all times - Though it may not be such a great schedule

- Constraint relaxation is easy (a repair step)

- Swapping tasks to reduce changeovers is easy (repair step)

- A complete assignment is often more informative in guiding search than a partial assignment (Johnston and Minton)

Page 60: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Iterative Repair (cont.)- Potentially many kinds of repair steps

- Using a few assumptions, problem can be reduced to very small number of kinds of repair steps

- Assume that a discrete-event simulator exists such that- Given an assignment of tasks to resources, and an ordering of tasks on resources

- Simulator propagates timing and resource constraints so that no resource is overloaded, state constraints are met, resource calendar constraints are met

- Note that order deadlines may not be met (soft constraint)

- Effectively simulates what would happen in real plant

- Continuous time representation

- Such a simulator is relatively easy to implement, and is fast

- Such a simulator can operate as the constraint propagation kernel of an iterative repair algorithm

- Given such a simulator, the only decisions to make are- Which resources to assign tasks to

- Sorting of tasks on a resource

- Repair steps are thus- Move task on a resource to a different sort position on that resource

- Move task to a different resource (insert somewhere in the new resource’s sort sequence)

Page 61: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Iterative Repair Example – Beer Scheduling- Filtering of alcoholic vs. non-alcoholic beer prior to packaging

Filter 1

HoldingTank

1HoldingTank

2

HoldingTank

3 HoldingTank

4

ToPackaging

Alcoholic

Non-Alcoholic

Page 62: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Iterative Repair Example – Beer Scheduling- RON

Packaging

FilteredBeer

HoldingTank

PackagedBeer

FilteringAged Beer

HoldingTank

Filter

Backwash

Filter

Page 63: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Iterative Repair Example – Beer Scheduling- Assume holding tank capacity is 100 gallons

- 3 orders each for 80 gallons alcoholic, non-alcoholic beer, interspersed as follows- (packaging tasks fixed)

Filter

Time

Resources

Tank1

1 2

Tank2

Tank3

Tank4

Packaging NAA

3

A NA A NA

Page 64: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Iterative Repair Example – Beer Scheduling- Simple dispatching produces following (flawed) schedule

Filter

Time

Resources

Tank1

1 2

Tank2

Tank3

Tank4

Packaging NAA

3

A NA A NA

A

A

A NA

NA

A A

A

NA

NA

AA A

A

Page 65: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Iterative Repair Example – Beer Scheduling- Iterative repair batches second A, NA tasks with first

- Note that further batching is not possible (would need more tanks)

Filter

Time

Resources

Tank1

1 2

Tank2

Tank3

Tank4

Packaging NAA

3

A NA A NA

A

A

A NA

NA

A A

A

NA

NA

AA A

A

Page 66: Finite Capacity Scheduling 6.834J, 16.412J. Overview of Presentation What is Finite Capacity Scheduling? Types of Scheduling Problems Background and History.

Summary

• Focus of this lecture was on generally useful techniques

• Solution of real-world scheduling problems can make use of these techniques, but also, often requires use of problem specific heuristics

• As with other problems, scheduling becomes easier as computers get faster (less need for problem-specific heuristics)