Scheduling and Resource Allocation
Scheduling and Resource Allocation
Clemen Kok
December 2024
1 Introduction to Scheduling
What is Scheduling? Job - Unit of work we want to process; Machine - Re-
source that can process jobs. Sequence - When to start, end, and resume. Also
consider parallel workflows, Due dates, Uncertain information.
1
Why would you choose to minimise Cmax ? Minimises Makespan, To-
tal time needed to complete all jobs, Ensures set of jobs is completed ASAP,
Ensures system resources are utilised efficiently, maximises throughput, higher
cost efficiency, Minimise idleness.
Assignments:
1. α = 1 Single Machine, P Parallel Machines
3 Release Times
Assumptions
• A set of n jobs is immediately ready to be scheduled.
2
• Single server machine.
• No explicit setup times.
• No machine idling while jobs are waiting.
– Idle - non pre-emptive - higher priority.
3
P
1|| wj Cj Problem
• Weighted Shortest Processing Time (WSPT) Rule (Smith’s rule).
• Schedules jobs in non-decreasing pj /wj ratio order.
• Let:
A : 1 → 2 → ··· → k
B : k + 1 → k + 2 → · · · → n.
Which should be processed first?
Interruptible Execution:
4
• WSPT may still be applied to sub-chains.
ρ-factor:
Pl
j=1 pj
ρA = min Pl .
1≤l≤k wj
j=1
• Initial subchains of A of length l: the one with the minimum ratio deter-
mines the ρ factor.
Key Points:
• Maximum is not tractable in stochastic vs deterministic cases.
4 Due Dates
Key Definitions
Each job has a due date dj (delivery time). Due dates are soft and can be
violated. The goal is to minimise deviations. The following metrics are defined:
• Lateness: Lj = Cj − dj
• Tardiness: Tj = max(0, Cj − dj )
5
Minimising Total Lateness (1||ΣLj )
Although the Shortest Processing Time (SPT) rule ignores the due dates dj , it
remains optimal for minimising total lateness.
Σj Lj = Σj (Cj − dj ) = Σj Cj − Σj dj
Since D = Σj dj is given and independent of the schedule, minimising total
lateness is equivalent to minimising total completion time. A similar situation
arises for the weighted analogue 1||Σwj Lj .
Focusing on Lmax
The total lateness ΣLj does not fully capture the significance of due dates.
Hence, the problem 1||ΣLj is seldom studied. Instead, the focus is often on
minimising the maximum lateness Lmax :
Lmax = max Lj
j
Stochastic Case
Under uncertainty, lateness and tardiness are harder to handle due to expec-
tations involving maxima of random variables. However, it can still be shown
that EDD remains optimal for 1||Lmax and 1||Tmax .
6
• No optimal rule like EDD or SPT exists.
• EDD is still optimal in restricted cases.
Agreeable Jobs
Jobs are agreeable if, for any two jobs i and j, pi ≥ pj implies di ≥ dj . If
all jobs are agreeable, total tardiness is minimised by EDD sequencing with
ties broken by SPT. This can be proven using adjacent pairwise interchange
analysis.
Moore-Hodgson Algorithm
The problem 1||Σj Uj is solvable exactly in polynomial time using the Moore-
Hodgson Algorithm. However, the weighted case is NP-hard.
Example:
7
5 Enumeration and Local Search
Introduction
Many scheduling problems are NP-Hard and cannot be solved efficiently if the
problem size is large enough. Combinatorial optimization involves minimizing
a cost function g(S) over all feasible schedules S.
Local Search
Similar to hill climbing but applied to discrete problems. A neighborhood N (S)
of the current solution S is generated using adjacent pairwise interchange, sub-
ject to constraints. The solution evolves by selecting the next one in N (S). May
get trapped in local optima.
Algorithm:
1. Start with an initial solution x0 .
2. At iteration k + 1, randomly choose a neighbour y ∈ N (xk ).
3. Compute cost change ∆ = g(xk ) − g(y): If ∆ ≥ 0, accept y as xk+1 = y.
If ∆ < 0, accept y with probability e∆/Tk .
4. Update temperature:
8
Tabu Search
A deterministic global optimization method using a memory structure called
the tabu list T . Tracks recently swapped job pairs to avoid cycling back to
previous solutions. Exceptions (aspiration criteria) allow revisiting a solution if
it improves the best overall result.
Algorithm:
1. Swap adjacent jobs i and j in schedule S. Add pair (i, j) to T .
2. Prevent re-swapping (i, j) for L iterations unless aspiration criteria are
met.
3. Stop when no further improvements are possible.
Handling Constraints
Schedules may have equality and inequality constraints:
Rejection Method
Skip candidate solutions violating constraints. Valid initial schedules required.
Complexity: O(n2n ).
9
6 Parallel Machine Scheduling
Introduction
1. Jobs are mapped to m identical parallel machines. 2. A job cannot run on
two machines at the same time. 3. The makespan problem, denoted P ||Cmax ,
is no longer trivial and equates to balancing job loads across machines. 4. For
m = 2, the problem is denoted P2 (parallel scheduling on two machines).
n1
X
C1,j = n1 p1,[1] + (n1 − 1)p1,[2] + · · · + p1,[n1 ] ,
j=1
.. ..
. .
nm
X
Cm,j = nm pm,[1] + (nm − 1)pm,[2] + · · · + pm,[nm ] .
j=1
3. SPT optimizes the system by sorting jobs in ascending size and then
applying round-robin across machines. 4. Weighted Shortest Processing Time
(WSPT) assigns jobsPto the first idle machine in increasing pi /wi ratios. While
not optimal for P || wj Cj , which is NP-hard, it serves as an approximation
with a worst-case ratio: √
1+ 2
R= ≈ 1.21.
2
5. Round-robin schedules jobs cyclically through m1 , m2 , . . . , mn .
Makespan Problems
1. With m machines, the makespan admits the lower bound:
P
pj
M ⋆ = max(pmax , ),
m
P
where pmax = max pj . 2. The term pj /m represents the optimal case where
all machines finish jobs simultaneously. 3. The pmax term arises because no job
can run on multiple machines simultaneously, so the longest job determines a
minimum makespan.
10
McNaughton’s Wrap Around Rule
1. Schedule an arbitrary job on machine m1 at time 0. 2. Start any unscheduled
job as soon as possible on the same machine. 3. Repeat the process until the
makespan on a machine exceeds M ⋆ or all jobs are scheduled. 4. Reassign
processing beyond M ⋆ to the next machine, starting at time 0. Repeat the
process.
Non-Preemptive Case
1. The non-preemptive makespan problem P is NP-hard, even with m = 2 ma-
chines. 2. Assuming integer pj and pj divisible by 2, P2 ||Cmax asks to
partition integers into two subsets summing to M ⋆ , equivalent to the partition
problem.
LS
2. Substituting tk = Cmax− pk and rearranging:
Pn
LS j=1 pj (m − 1)pk
Cmax ≤ + .
m m
OP T
3. The optimal makespan satisfies Cmax ≤ M ⋆ , where:
Pn
j=1 pj OP T OP T
≤ Cmax , pk ≤ pmax < Cmax .
m
4. Therefore:
LS
Cmax 1
OP T
=2− .
Cmax m
11
Longest Processing Time (LPT)
1
1. List scheduling achieves a (2 − m ) approximation if no specific job priority
order is specified. 2. LPT assigns jobs in non-increasing order of size. LS with
LPT achieves a smaller worst-case ratio:
4 1
R= − .
3 3m
7 Workflow Scheduling
Directed Acyclic Graphs (DAGs)
1. Job precedences are represented as a Directed Acyclic Graph (DAG) G =
(V, E):
• Vertices V are jobs.
• An edge (i, j) ∈ E indicates that job i must complete before job j
can start.
2. Precedence constraints frequently require forced idleness.
3. Scheduling theory under precedence constraints is challenging:
Hu’s Algorithm
1. Hu’s algorithm solves P |i.t., pj = 1|Cmax (parallel scheduling with in-tree
precedence constraints).
2. Assign a level αj to each job j as follows:
• The exit node is labeled with αj = 1.
• For all other nodes:
αj = 1 + max αi .
i:(j,i)∈E
12
3. The maximum level is L = maxi αi , and αj − 1 is the path length from j
to the exit node. The longest path is called the critical path.
4. Hu’s algorithm schedules ready jobs in non-decreasing αj order, with com-
plexity O(n).
• Worst-case ratio:
(
4
R= 3, if m = 2,
1
2− m−1 , if m ≥ 3.
Muntz-Coffman Algorithm
1. The Muntz-Coffman algorithm extends Hu’s algorithm to the preemptive
case.
2. A subset sequence S1 , S2 , . . . , Sk is defined as follows:
• Each job a ∈ G belongs to some Si .
• If a ∈ Sj is a successor of b ∈ Si , then j > i.
13
• P |pmtn, o.t., pj = 1|Cmax .
2. Under preemptive scheduling, pj > 1 can be divided into jobs with pj = 1.
3. The worst-case ratio for general preemptive scheduling P |pmtn, prec|Cmax
is:
2
R = 2 − , m ≥ 2.
m
4. The algorithm is optimal for m = 2 and near-optimal for small m > 2.
8 Bottleneck Analysis
System Overview
1. Jobs arrive at the system, are processed by machines, and then completed.
2. Assumptions:
• A1: The system has M machines with arbitrary speeds.
• A2: Jobs arrive at arbitrary times, not known in advance.
• A3: Jobs may visit more than one machine and do not incur com-
munication overheads.
• A4: Job processing times are arbitrary and machine-dependent.
• A5: Job sequencing at machines is arbitrary.
• A6: Inside the system, there is no job creation, destruction, or par-
allel execution of a single job.
3. Key questions:
• Bottleneck Analysis: Which machines limit the peak completion
rate?
• What-if Analysis: How will changes in job arrival rates or machine
speeds impact the system?
4. Performance factors:
• Arrival rate of jobs.
• Processing time of jobs at the machine.
• Utilization (fraction of time the machine is busy).
• Contention.
14
Job Classes
1. The open system:
• Processes jobs using M machines.
• Offers C types of services (job classes).
• Receives class-c jobs at rate λc .
2. For a class-c job:
• Visits machine i, on average, vic times.
• Requires a mean processing time pic for each visit.
• Demand:
Dic = vic pic ,
the total processing time accumulated on average during visits to
machine i.
Operational Analysis
1. Monitor a machine for an observation period T seconds and collect:
• Ac : Total number of arrived jobs of class c.
• Bic : Total time machine i is busy processing class-c jobs.
• Fc : Total number of finished jobs of class c.
2. Compute:
• λc = Ac /T : Average arrival rate of jobs of class c.
• Xc = Fc /T : Average system throughput of jobs of class c.
• Uic = Bic /T : Utilization of machine i for class-c jobs.
3. Stability:
• If the number of pending jobs remains finite, the system is stable.
• In a stable system:
Fc
λc = Xc = lim .
T →∞ T
• Unstable systems cannot cope with arrival rates, causing the backlog
of pending jobs to grow unbounded.
15
Utilization Law
1. Demand:
Bic
Dic = .
Ac
2. Utilization:
Bic Ac Bic
Uic = = · = λc Dic .
T T Ac
3. For C job classes, the total utilization of machine i is:
C
X C
X C
X
Ui = Uic = λc Dic = Xc Dic .
c=1 c=1 c=1
4. Estimating demand:
• Use multivariate linear regression to fit hyperplanes to samples of Ui
and λc .
• Estimated demands Dic are hardware-dependent and change after
machine upgrades.
Bottleneck Analysis
1. Bottlenecks:
• Machines that limit performance by struggling to handle arrival rates.
• Tend to operate near 100
2. Single class (C = 1):
• For every machine i:
Ui = λDi .
• Maximum arrival rate:
1
λ≤ ,
Dmax
where Dmax = max(D1 , . . . , DM ).
• Bottlenecks correspond to machines with Dmax .
3. Multi-class (C > 1):
• Machine usage is described by:
C
X
Ui = λc Dic .
c=1
16
• Verify saturation using linear programming (LP):
C
X
Ujmax = max λc Djc ,
c=1
subject to:
C
X
λc Dic ≤ 1, λc ≥ 0.
c=1
• Players: i = 1, . . . , N .
• Each player has a set of actions xi ∈ Xi .
• Each player incurs a cost Ji (x1 , . . . , xN ), which depends on everyone’s
choices.
2 1 X
Ji (x1 , . . . , xN ) = · xj − xi .
3 N j
R S
R (30, 0) (30, 10)
S (100, 100) (0, 10)
Nash Equilibria
1. A Nash equilibrium (N.E.) models emergent behavior.
• A pure N.E. is a feasible allocation such that no player can decrease
their cost by unilateral deviation.
17
2. Definition:
(x⋆1 , . . . , x⋆N ) ∈ X1 ×· · ·×XN is a N.E. if Ji (x⋆i , x⋆−i ) ≤ Ji (xi , x⋆−i ) ∀xi ∈ Xi , ∀i.
Here:
• x−i represents the strategies of all players except i.
• xi is the strategy of player i.
3. Example:
A B
A (30, 0) (30, 10)
B (11, 11) (0, 10)
The N.E. is (10, 10), as neither player has an incentive to deviate.
2. Steps:
(a) Initialize strategies x and set i = 1.
(b) Check if x is an equilibrium; if so, stop.
(c) Update xi ← BR(x−i ).
(d) Set i ← (i mod N ) + 1.
(e) Repeat.
3. Convergence:
• If the current allocation minimizes the cost, no one will change their
strategy.
• The algorithm converges to a Nash equilibrium.
3. Definition:
(σ1⋆ , . . . , σN
⋆
) ∈ ∆1 ×· · ·×∆N is a mixed N.E. if Ci (σi⋆ , σ−i
⋆
) ≤ Ci (x′i , σ−i
⋆
) ∀x′i ∈ Xi , ∀i.
18
Matching Pennies Example
1. Game:
H T
H (1, −1) (−1, 1)
T (−1, 1) (1, −1)
4. Expected payoffs:
(
H : 1 · q + (−1) · (1 − q) = 2q − 1,
Row Player (P1):
T : (−1) · q + 1 · (1 − q) = −2q + 1.
(
H : −1 · p + 1 · (1 − p) = −2p + 1,
Column Player (P2):
T : 1 · p + (−1) · (1 − p) = 2p − 1.
19
2. Formal definition:
• A strategic game is a potential game if there exists a function Φ :
X → R such that:
• Each time a player improves their utility, the potential changes ac-
cordingly.
• Cyclic behavior is impossible as it would imply Φ(x1 ) > Φ(x2 ) >
· · · > Φ(x1 ), which is contradictory.
Congestion Games
1. Congestion games model scenarios where players share resources, and the
cost depends on resource usage.
2. Components:
• Set of resources R.
• Resource cost functions ↕r (·): latency functions specific to each re-
source.
• Set of players {1, . . . , N }.
• Feasible set Xi ⊆ 2R for each player i, representing the resources
they can choose.
• Player cost: X
Ji (x) = ↕r (|x|r ),
r∈xi
20
• Each player’s cost equals the runtime of their chosen machine.
4. Best Response (BR) convergence:
• Congestion games are potential games, with potential function:
|x|r
XX
Φ(x) = ↕r (j).
r∈R j=1
where ¯↕r (j) are the sorted integer latencies for resource r.
• The potential is bounded by n2 m, as the maximum decrease in po-
tential per BR step is at least 1.
5. Example calculation:
• Suppose R1 and R2 are resources with latencies:
↕R1 (1) = 1, ↕R1 (2) = 3, ↕R1 (3) = 5,
↕R2 (1) = 2, ↕R2 (2) = 4, ↕R2 (3) = 6.
After sorting latencies, assign new integer values:
¯
↕R1 (1) = 1, ¯↕R (1) = 2, ¯↕R (2) = 3.
2 1
21
• Compute potential:
– R1 has 2 players. Sum latencies:
¯↕R (1) + ¯↕R (2) = 1 + 3 = 4.
1 1
– Total potential:
Φ(x) = 4 + 2 = 6.
• The potential decreases with each BR step and is bounded by n2 m.
11 Efficiency of Equilibria
Braess Paradox
1. Consider two routes from A to B:
• North: road and ferry.
• South: ferry and road.
2. Initially, 200 players split equally between the two routes (100, 100).
4. The new equilibrium increases overall travel cost, illustrating Braess Para-
dox.
maxx∈P N E SC(x)
P oA = .
minx∈X SC(x)
22
2. Interpretation:
• Measures the performance degradation from selfish decision-making.
• SC(x) is typically the sum of players’ costs.
3. Example:
• Worst Nash equilibrium (no ferry): SC = 14000.
• Optimal allocation: SC = 12875.
• Price of anarchy:
14000
P oA = ≈ 1.087.
12875
4. Implication:
• PoA quantifies the inefficiency caused by selfish behavior.
• Use incentives to reduce P oA.
2. PoA bound:
• In a (λ, µ)-smooth game:
λ
P oA ≤ .
1−µ
3. Proof:
• Let x be a Nash equilibrium and x′ an optimal allocation.
• From the definition of Nash equilibrium:
X X
SC(x) = Ji (x) ≤ Ji (x′i , x−i ).
i i
• Combining:
SC(x) ≤ λSC(x′ ) + µSC(x).
• Rearranging:
SC(x)(1 − µ) ≤ λSC(x′ ),
SC(x) λ
≤ .
SC(x′ ) 1−µ
23
Affine Congestion Games and Exact PoA
1. For congestion games with affine latencies:
ℓr (|x|r ) = αr |x|r + βr .
5
P oA ≤ = 2.5.
2
3. Proof (outline):
• Social cost:
X X
SC(x) = Ji (x) = |x|r ℓr (|x|r ).
i r
• Smoothness condition:
X 5 1
Ji (x′i , x−i ) ≤ SC(x′ ) + SC(x).
i
3 3
• Goal:
5 ′ 1
|x′r |ℓr (|x|r + 1) ≤ |x |ℓr (|x′r |) + |xr |ℓr (|x|r ), ∀x, x′ , r.
3 r 3
Congestion Pricing
• Design tolls τr (|x|r ) for each resource to incentivize optimal behavior:
ℓr (|x|r ) + τr (|x|r ).
12 Auctions
Utility of a Bidder
(
0, if loses auction,
Utility Bidder i =
vi − p, if wins auction,
where vi is the bidder’s valuation and p is the price paid.
Sealed-Bid Auction
• Each bidder privately submits a bid to the auctioneer.
• The auctioneer:
1. Decides who gets the good (e.g., highest bid wins).
2. Sets the selling price (affects bidder behavior).
• Bidders underbid because bidding true valuation yields zero utility. The
degree of underbidding depends on unseen competitor bids.
24
Second-Price Auction (Vickrey)
• In a second-price auction, every bidder has a dominant strategy: bid their
true valuation.
• Key properties:
25
Myerson’s Lemma
• Setting:
1. Allocation Space X :
– Single-item auctions: X = {0, 1}n , with i xi = 1.
P
2. For monotone x, there exists a unique payment rule p such that (x, p)
is DSIC.
3. The payment rule can be derived analytically.
• Observations:
– Monotonicity ensures implementability.
– The payment rule is unique.
• Implications:
– x(z) must be monotone; otherwise, the inequality is violated.
– The payment difference p(y) − p(z) is bounded by changes in alloca-
tion probability scaled by z and y.
26
Guessing the Price Function
• Use discontinuities in x to derive p:
• At a discontinuity:
∆p = h · z,
where h is the height of the discontinuity.
• Fix p(0) = 0. Candidate formula:
l
X
pi (bi , b−i ) = zj · (jump in xi (·, b−i ) at zj ).
j=1
27