Earliest-start search
Also known as earliest-feasible-start search
scheduling resource-timeline
Earliest-start search finds the first start time in a window at which an activity fits on every resource timeline of a plan. A timeline tracks one resource level over integer ticks, and the activity fits when no level leaves its allowed range. The answer can only change where a tick of the activity meets a change tick or a target of a timeline, so the search walks the pieces between these candidate starts and does not test each tick. Without rates, the levels are step functions, and one check at the start of a piece decides the whole piece. With rates, each level is a linear function of the start inside a piece, so the search solves the inequalities in closed form, and the cost does not grow with the window length.
Pseudocode
algorithm Earliest-Start(P, DEMANDS, e, l, max-checks)input: plan P of timelines, the demands of one activity relative to its start, start window [e, l]output: the earliest start in [e, l] at which the activity fits, or nils ← smallest start ≥ e at which no demand precedes its timeline startchecks ← 0while s ≠ nil and s ≤ l doif checks = max-checks thenerror "search exhausted"checks ← checks + 1s′ ← next-candidate(s) ▷ where a demand tick meets a change tick or targetif rates are involved thenhi ← l if s′ = nil, else min(s′ − 1, l)found ← earliest-in(s, hi)if found ≠ nil thenreturn foundelse if fits(P, DEMANDS, s) thenreturn s ▷ the answer is constant on the pieces ← s′return nilfunction earliest-in(lo, hi)K ← [0, hi − lo] ▷ offsets from lofor each level v that must stay within [min, max] on the piece dov₀, slope ← v at lo, v at lo + 1 minus v at lo ▷ v is affine in the start hereK ← {k ∈ K : min ≤ v₀ + slope · k ≤ max} ▷ one floor or ceiling divisionif K = ∅ thenreturn nilreturn lo + min(K)In the crates
resource-timelineFinds the earliest start in a window at which an activity fits on every timeline of a plan, solved in closed form per linear piece when rates are involved.
Lineage
Comes from
Nothing on this site.
Led to
Greedy priority scheduling builds on it