Algorithm Search⌘K

Algorithmintro

ASAP and ALAP scheduling

Also called as soon as possible scheduling, as late as possible scheduling, operation mobility.

Schedules each operation of a data flow graph at its earliest or latest step under precedence, which gives the mobility of each operation.

Time
O(V + E) worst
Space
O(V + E) extra
Where
E = the number of data edges; V = the number of operations
Properties
deterministicexactofflineiterative
Origin
James E. Kelley Jr., Morgan R. Walker, 1959

ASAP and ALAP scheduling give each operation of a data flow graph a start step when there is no limit on the number of functional units. The as soon as possible (ASAP) schedule starts every operation at the first step after all its inputs are ready. The as late as possible (ALAP) schedule starts every operation at the last step that still lets all the operations after it end by a latency bound LL. Both schedules are one pass of a DAG longest path computation in topological order, so each takes O(V+E)O(V + E) time. The difference ALAP minus ASAP is the mobility of an operation, and the interval between them is its time frame. High-level synthesis uses the ASAP schedule for the least latency, and uses the time frames as the input of resource-constrained schedulers such as force-directed scheduling.

In plain words

A program for hardware is a set of operations, such as multiplies and adds. Some operations need the result of others. A clock step is the unit of time, and each operation takes one or more steps. If you have as many adders and multipliers as you want, you can start each operation as soon as its inputs are ready. That is the ASAP schedule, and its length is the shortest possible. If you must finish by some step, you can also start each operation as late as possible, so that the work after it still fits. That is the ALAP schedule. An operation whose two start steps are the same is on the critical path and has no freedom. An operation with a gap between them can move inside that gap.

The problem

The input is a data flow graph G=(V,E)G = (V, E) with no cycles. Each operation vv has a delay δ(v)≥1\delta(v) \ge 1 in control steps. An edge (u,v)(u, v) means that vv reads the result of uu, so a schedule t:V→{1,2,… }t : V \to \{1, 2, \dots\} must have t(v)≥t(u)+δ(u)t(v) \ge t(u) + \delta(u). Operation vv uses the steps t(v)t(v) to t(v)+δ(v)−1t(v) + \delta(v) - 1. The schedule meets the latency bound LL when t(v)+δ(v)−1≤Lt(v) + \delta(v) - 1 \le L for all vv. The output is the ASAP schedule tSt_S, the ALAP schedule tLt_L for a given LL, and the mobility μ(v)=tL(v)−tS(v)\mu(v) = t_L(v) - t_S(v). The algorithm has no limit on the number of units. With such a limit, the problem is NP-hard (see the high-level synthesis page).

The algorithm

  1. ASAP(G, δ)
  2. 1order ← a topological order of G ▷ fails if G has a cycle
  3. 2for each v in order do
  4. 3t_S(v) ← max(1, max over edges (u, v) of t_S(u) + δ(u))
  5. 4return t_S
  6. ALAP(G, δ, L)
  7. 5for each v in the reverse of order do
  8. 6t_L(v) ← min(L + 1, min over edges (v, w) of t_L(w)) - δ(v)
  9. 7if t_L(v) < 1 for some v then return "infeasible"
  10. 8return t_L
  11. MOBILITY(G, δ, L)
  12. 9return t_L(v) - t_S(v) for each v

Line L3 takes the latest end of an input, so tS(v)−1t_S(v) - 1 is the largest total delay of a path that ends just before vv. Line L6 is the mirror image: L+1−tL(v)L + 1 - t_L(v) is the largest total delay of a path that starts at vv, with vv counted. The value L+1L + 1 on line L6 stands for a sink after the last step. Line L7 fails exactly when LL is less than the length of the critical path.

Example

Take the differential equation example of Paulin and Knight, one loop step of a solver for y′′+3xy′+3y=0y'' + 3xy' + 3y = 0. It has six multiplies and five ALU operations, all with delay 1. With u=y′u = y', one loop step computes u1=u−3xu dx−3y dxu_1 = u - 3xu\,dx - 3y\,dx, y1=y+u dxy_1 = y + u\,dx, x1=x+dxx_1 = x + dx, and the test x1<ax_1 < a.

op computes ASAP ALAP at L=4L = 4 mobility
v1v_1 3⋅x3 \cdot x 1 1 0
v2v_2 u⋅dxu \cdot dx 1 1 0
v3v_3 v1⋅v2v_1 \cdot v_2 2 2 0
v4v_4 u−v3u - v_3 3 3 0
v5v_5 v4−v7v_4 - v_7 4 4 0
v6v_6 3⋅y3 \cdot y 1 2 1
v7v_7 v6⋅dxv_6 \cdot dx 2 3 1
v8v_8 u⋅dxu \cdot dx 1 3 2
v9v_9 y+v8y + v_8 2 4 2
v10v_{10} x+dxx + dx 1 3 2
v11v_{11} v10<av_{10} < a 2 4 2

The ASAP schedule ends at step 4, so the least latency is 4, and the chain v1→v3→v4→v5v_1 \to v_3 \to v_4 \to v_5 is critical. At L=3L = 3, line L6 gives tL(v1)=0t_L(v_1) = 0, and ALAP reports "infeasible". At L=6L = 6, every mobility grows by 2: the five critical operations get mobility 2, v6v_6 and v7v_7 get 3, and the rest get 4. The ASAP schedule puts four multiplies at step 1, while the ALAP schedule at L=4L = 4 puts three ALU operations at step 4. Neither is a good use of hardware, which is why resource-constrained schedulers move the operations inside their frames.

A multicycle case. A multiply of delay 2 feeds an add, and a second add stands alone. ASAP gives the starts (1,3,1)(1, 3, 1) and a latency of 3. At L=3L = 3, ALAP gives (1,3,3)(1, 3, 3). At L=5L = 5, it gives (3,5,5)(3, 5, 5). At L=2L = 2, it fails.

Correctness

Every schedule that meets LL starts each operation between its ASAP and its ALAP step, by induction along the topological order for the lower bound and along the reverse order for the upper bound. Both tSt_S and tLt_L are themselves schedules, so they are the earliest and the latest schedule, one operation at a time. The time frame is exact: for every step ss with tS(v)≤s≤tL(v)t_S(v) \le s \le t_L(v), some schedule that meets LL starts vv at ss. The ASAP schedule has latency equal to the critical path length, and line L7 fails exactly when LL is smaller. The full proof gives the details.

Proof: ASAP and ALAP are the pointwise earliest and latest schedules, and the frames are exactfull

We use the notation of the page. G=(V,E)G = (V, E) has no cycle, every δ(v)≥1\delta(v) \ge 1, and a schedule for LL is a map t:V→Zt : V \to \mathbb{Z} with t(v)≥1t(v) \ge 1, t(v)≥t(u)+δ(u)t(v) \ge t(u) + \delta(u) for every edge (u,v)(u, v), and t(v)+δ(v)−1≤Lt(v) + \delta(v) - 1 \le L for every vv.

For a path p=x0x1⋯xkp = x_0 x_1 \cdots x_k, let δ(p)=∑i=0kδ(xi)\delta(p) = \sum_{i=0}^{k} \delta(x_i). Let in(v)\mathrm{in}(v) be the largest δ(p)−δ(v)\delta(p) - \delta(v) over paths pp that end at vv, and let out(v)\mathrm{out}(v) be the largest δ(p)\delta(p) over paths that start at vv. The one-vertex path gives in(v)≥0\mathrm{in}(v) \ge 0 and out(v)≥δ(v)\mathrm{out}(v) \ge \delta(v). The critical path length is cp=max⁡v(in(v)+δ(v))\mathrm{cp} = \max_v (\mathrm{in}(v) + \delta(v)), which is also max⁡vout(v)\max_v \mathrm{out}(v).

Lemma 1 (closed forms). Lines L1 to L4 give tS(v)=1+in(v)t_S(v) = 1 + \mathrm{in}(v). Lines L5 and L6 give tL(v)=L+1−out(v)t_L(v) = L + 1 - \mathrm{out}(v).

Proof. Line L1 succeeds because GG has no cycle. In topological order, all predecessors of vv are done before vv. By induction, line L3 gives tS(v)=max⁡(1,max⁡(u,v)(1+in(u)+δ(u)))t_S(v) = \max(1, \max_{(u,v)} (1 + \mathrm{in}(u) + \delta(u))). A longest path ending at vv is either vv alone, with in=0\mathrm{in} = 0, or a longest path ending at a predecessor uu followed by the edge (u,v)(u, v), with in(u)+δ(u)\mathrm{in}(u) + \delta(u). So the right side is 1+in(v)1 + \mathrm{in}(v). The ALAP case is the same argument on the reverse graph: line L6 gives min⁡(L+1,min⁡(v,w)(L+1−out(w)))−δ(v)=L+1−δ(v)−max⁡(0,max⁡(v,w)out(w))=L+1−out(v)\min(L + 1, \min_{(v,w)} (L + 1 - \mathrm{out}(w))) - \delta(v) = L + 1 - \delta(v) - \max(0, \max_{(v,w)} \mathrm{out}(w)) = L + 1 - \mathrm{out}(v). □\square

Lemma 2 (bounds). Every schedule tt for LL has tS(v)≤t(v)≤tL(v)t_S(v) \le t(v) \le t_L(v) for every vv.

Proof. Let p=x0⋯xkp = x_0 \cdots x_k end at xk=vx_k = v. The edges give t(xi)≥t(xi−1)+δ(xi−1)t(x_{i}) \ge t(x_{i-1}) + \delta(x_{i-1}), so t(v)≥t(x0)+δ(p)−δ(v)≥1+δ(p)−δ(v)t(v) \ge t(x_0) + \delta(p) - \delta(v) \ge 1 + \delta(p) - \delta(v). Taking the largest such path gives t(v)≥1+in(v)=tS(v)t(v) \ge 1 + \mathrm{in}(v) = t_S(v). Now let pp start at x0=vx_0 = v. In the same way t(xk)≥t(v)+δ(p)−δ(xk)t(x_k) \ge t(v) + \delta(p) - \delta(x_k), and t(xk)+δ(xk)−1≤Lt(x_k) + \delta(x_k) - 1 \le L, so t(v)≤L+1−δ(p)t(v) \le L + 1 - \delta(p). Taking the largest path gives t(v)≤L+1−out(v)=tL(v)t(v) \le L + 1 - \mathrm{out}(v) = t_L(v). □\square

Lemma 3 (both are schedules). tSt_S is a schedule for every L≥cpL \ge \mathrm{cp}, with latency exactly cp\mathrm{cp}. tLt_L is a schedule for LL exactly when L≥cpL \ge \mathrm{cp}, and line L7 fails exactly when L<cpL < \mathrm{cp}.

Proof. Line L3 gives tS(v)≥1t_S(v) \ge 1 and tS(v)≥tS(u)+δ(u)t_S(v) \ge t_S(u) + \delta(u) for every edge. The last step used is max⁡v(tS(v)+δ(v)−1)=max⁡v(in(v)+δ(v))=cp\max_v (t_S(v) + \delta(v) - 1) = \max_v (\mathrm{in}(v) + \delta(v)) = \mathrm{cp} by Lemma 1. Line L6 gives tL(v)≤tL(w)−δ(v)t_L(v) \le t_L(w) - \delta(v) for every edge (v,w)(v, w), and tL(v)+δ(v)−1≤Lt_L(v) + \delta(v) - 1 \le L. So tLt_L meets all conditions except possibly tL(v)≥1t_L(v) \ge 1. By Lemma 1, min⁡vtL(v)=L+1−max⁡vout(v)=L+1−cp\min_v t_L(v) = L + 1 - \max_v \mathrm{out}(v) = L + 1 - \mathrm{cp}, which is at least 1 exactly when L≥cpL \ge \mathrm{cp}. If L<cpL < \mathrm{cp}, no schedule exists at all, since a schedule has latency at least that of tSt_S by Lemma 2. □\square

Theorem 1. If L≥cpL \ge \mathrm{cp}, tSt_S and tLt_L are schedules for LL, and for every vv, tS(v)t_S(v) is the least and tL(v)t_L(v) is the largest value of t(v)t(v) over all schedules tt for LL. If L<cpL < \mathrm{cp}, ALAP returns "infeasible" and no schedule exists. Line L9 returns μ(v)=tL(v)−tS(v)≥0\mu(v) = t_L(v) - t_S(v) \ge 0.

Proof. Lemmas 2 and 3. The mobility is nonnegative because tLt_L is a schedule and Lemma 2 applies to it. □\square

Theorem 2 (the frames are exact). Let L≥cpL \ge \mathrm{cp}, let vv be an operation and let tS(v)≤s≤tL(v)t_S(v) \le s \le t_L(v). Then some schedule for LL has t(v)=st(v) = s.

Proof. For each xx, let g(x)g(x) be the largest δ(p)−δ(x)\delta(p) - \delta(x) over paths pp from vv to xx, or −∞-\infty if there is none. So g(v)=0g(v) = 0. Put t(x)=max⁡(tS(x),s+g(x))t(x) = \max(t_S(x), s + g(x)). Then t(v)=max⁡(tS(v),s)=st(v) = \max(t_S(v), s) = s.

Precedence. Let (x,y)(x, y) be an edge. Then tS(y)≥tS(x)+δ(x)t_S(y) \ge t_S(x) + \delta(x) by line L3. If g(x)>−∞g(x) > -\infty, the path to xx followed by the edge gives g(y)≥g(x)+δ(x)g(y) \ge g(x) + \delta(x). So both terms of t(y)t(y) are at least the matching term of t(x)t(x) plus δ(x)\delta(x), and t(y)≥t(x)+δ(x)t(y) \ge t(x) + \delta(x).

Range. t(x)≥tS(x)≥1t(x) \ge t_S(x) \ge 1. For the latency, tS(x)≤tL(x)t_S(x) \le t_L(x) by Theorem 1. If g(x)>−∞g(x) > -\infty, take a path pp from vv to xx with δ(p)−δ(x)=g(x)\delta(p) - \delta(x) = g(x). Then out(v)≥g(x)+out(x)\mathrm{out}(v) \ge g(x) + \mathrm{out}(x), because pp followed by a longest path from xx is a path from vv. So s+g(x)≤tL(v)+g(x)=L+1−out(v)+g(x)≤L+1−out(x)=tL(x)s + g(x) \le t_L(v) + g(x) = L + 1 - \mathrm{out}(v) + g(x) \le L + 1 - \mathrm{out}(x) = t_L(x). In both cases t(x)≤tL(x)t(x) \le t_L(x), so t(x)+δ(x)−1≤tL(x)+δ(x)−1≤Lt(x) + \delta(x) - 1 \le t_L(x) + \delta(x) - 1 \le L. ■\blacksquare

Fixed starts. The variant on the page with fixed starts is the same pair of passes with extra lower and upper bounds on some operations. The correctness proof of force-directed scheduling shows that its frames are exact too.

Termination. Each line runs over a finite list, and no line repeats.

Complexity

Line L1 is Kahn's algorithm in O(V+E)O(V + E) time. Lines L2 and L3 look at each edge once, from its head, and lines L5 and L6 look at each edge once, from its tail. So each schedule takes O(V+E)O(V + E) time and O(V+E)O(V + E) space for the adjacency lists. Mobility costs one ASAP and one ALAP pass. A new latency bound needs only a new ALAP pass.

Properties

  • Exact. Both schedules are optimal for what they compute, and the result is fully determined by the graph, the delays and LL.
  • Pointwise extremes. No schedule starts an operation earlier than ASAP or later than ALAP.
  • No resources. The schedules can use any number of units in one step. The number of units that they need is only a result.
  • Shift with LL. Raising LL by kk raises every ALAP step by kk and leaves ASAP unchanged.

Variants and improvements

  • Fixed starts. If some operations must start at given steps, apply the same two passes with tS(v)t_S(v) raised to the fixed value and tL(v)t_L(v) lowered to it. This is how force-directed scheduling updates the frames after each decision, and the frames stay exact.
  • Chaining. If several fast operations fit into one step, the passes work on delays in time units and pack them into steps with a cycle time, as in static timing analysis.
  • Timing constraints. Minimum and maximum distances between operations give a graph with cycles. Then the earliest starts are longest paths in a graph with no positive cycle, computed by Bellman-Ford style relaxation.
  • List scheduling. List scheduling adds unit limits and uses the mobility, or the ALAP step, as the priority of the ready operations.

When to use it

Use ASAP to find the least latency of a data flow graph, and ALAP to find how much each operation can move under a latency bound. Use both as the first step of a resource-constrained scheduler, to bound the search, to order the operations, or to fix the critical ones. Do not use the ASAP or ALAP schedule as the final schedule when the number of units matters.

Pitfalls

  • Off by one. With steps numbered from 1 and vv using t(v)t(v) to t(v)+δ(v)−1t(v) + \delta(v) - 1, the ALAP start is L+1L + 1 minus the path delay from vv. Many write-ups use steps from 0, and mixing the two forms gives a frame that is one step off.
  • Cycles. A data flow graph of a loop body has a back edge from one iteration to the next. Remove it, or treat it as a timing constraint, before the passes, or the topological order does not exist.
  • Infeasible bound. If LL is less than the critical path length, the ALAP formula gives starts below 1. Check for this, as line L7 does, and do not use those values.
  • Mobility is not freedom of all operations at once. Two operations on one path can each move within their frames, but not always at the same time. Moving one may shrink the frame of the other.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

asap_alap_scheduling.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/asap-alap-scheduling/. The authors are listed in prov/5S0Z4R.jsonl.

"""ASAP and ALAP schedules of a data flow graph.

Operations are 0 .. n-1. Operation v takes delay[v] >= 1 control steps.
An edge (u, v) says that v reads the result of u, so v may start only
after u ends: t(v) >= t(u) + delay[u]. Steps are numbered from 1, and an
operation that starts at step t uses the steps t .. t + delay[v] - 1.
A schedule meets the latency bound L when every operation ends by step L.
"""

from typing import Optional


def topological_order(n: int, edges: list[tuple[int, int]]) -> list[int]:
    """Kahn's algorithm. Raises ValueError on a cycle."""
    succ: list[list[int]] = [[] for _ in range(n)]
    indeg = [0] * n
    for (u, v) in edges:
        succ[u].append(v)
        indeg[v] += 1
    order = []
    ready = [v for v in range(n) if indeg[v] == 0]
    while ready:
        u = ready.pop()
        order.append(u)
        for v in succ[u]:
            indeg[v] -= 1
            if indeg[v] == 0:
                ready.append(v)
    if len(order) < n:
        raise ValueError("the data flow graph has a cycle")
    return order


def asap(n: int, delay: list[int], edges: list[tuple[int, int]]) -> list[int]:
    """The earliest start step of each operation."""
    pred: list[list[int]] = [[] for _ in range(n)]
    for (u, v) in edges:
        pred[v].append(u)
    t = [0] * n
    order = topological_order(n, edges)  # @line L1
    for v in order:  # @line L2
        t[v] = max([1] + [t[u] + delay[u] for u in pred[v]])  # @line L3
    return t  # @line L4


def alap(n: int, delay: list[int], edges: list[tuple[int, int]], latency: int) -> Optional[list[int]]:
    """The latest start step of each operation with every operation done by
    step latency. None if the latency is shorter than the critical path."""
    succ: list[list[int]] = [[] for _ in range(n)]
    for (u, v) in edges:
        succ[u].append(v)
    t = [0] * n
    order = topological_order(n, edges)
    for v in reversed(order):  # @line L5
        t[v] = min([latency + 1] + [t[w] for w in succ[v]]) - delay[v]  # @line L6
    if any(x < 1 for x in t):  # @line L7
        return None
    return t  # @line L8


def latency_of(start: list[int], delay: list[int]) -> int:
    """The last step that the schedule uses."""
    return max((s + dl - 1 for s, dl in zip(start, delay)), default=0)


def mobility(n: int, delay: list[int], edges: list[tuple[int, int]], latency: int) -> Optional[list[int]]:
    """ALAP minus ASAP for each operation, or None if the latency is too short."""
    late = alap(n, delay, edges, latency)
    if late is None:
        return None
    early = asap(n, delay, edges)
    return [b - a for a, b in zip(early, late)]  # @line L9
test_asap_alap_scheduling.py 113 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/asap-alap-scheduling/. The authors are listed in prov/5S0Z4R.jsonl.

import itertools
import random

import pytest

from asap_alap_scheduling import alap, asap, latency_of, mobility, topological_order

# The differential equation example (Paulin and Knight): v1 .. v11 are 0 .. 10.
DIFFEQ_N = 11
DIFFEQ_EDGES = [(0, 2), (1, 2), (2, 3), (3, 4), (5, 6), (6, 4), (7, 8), (9, 10)]


def random_dag(rng, n, p=0.35, most=3):
    delay = [rng.randint(1, most) for _ in range(n)]
    edges = [(u, v) for u in range(n) for v in range(u + 1, n) if rng.random() < p]
    perm = list(range(n))
    rng.shuffle(perm)  # hide the numbering order from the code under test
    return delay_perm(delay, perm), [(perm[u], perm[v]) for (u, v) in edges]


def delay_perm(delay, perm):
    out = [0] * len(delay)
    for i, x in enumerate(delay):
        out[perm[i]] = x
    return out


def longest_from_sources(n, delay, edges, v):
    """The largest delay sum of a path that ends just before v, by walking all paths."""
    pred = [[] for _ in range(n)]
    for (a, b) in edges:
        pred[b].append(a)
    return max([0] + [delay[u] + longest_from_sources(n, delay, edges, u) for u in pred[v]])


def longest_to_sinks(n, delay, edges, v):
    """The largest delay sum of a path that starts at v, with v."""
    succ = [[] for _ in range(n)]
    for (a, b) in edges:
        succ[a].append(b)
    return delay[v] + max([0] + [longest_to_sinks(n, delay, edges, w) for w in succ[v]])


def feasible_schedules(n, delay, edges, latency):
    for t in itertools.product(range(1, latency + 1), repeat=n):
        if all(t[v] >= t[u] + delay[u] for (u, v) in edges) and latency_of(list(t), delay) <= latency:
            yield t


def test_diffeq():
    d = [1] * DIFFEQ_N
    assert asap(DIFFEQ_N, d, DIFFEQ_EDGES) == [1, 1, 2, 3, 4, 1, 2, 1, 2, 1, 2]
    assert alap(DIFFEQ_N, d, DIFFEQ_EDGES, 4) == [1, 1, 2, 3, 4, 2, 3, 3, 4, 3, 4]
    assert mobility(DIFFEQ_N, d, DIFFEQ_EDGES, 4) == [0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2]
    assert alap(DIFFEQ_N, d, DIFFEQ_EDGES, 3) is None
    assert mobility(DIFFEQ_N, d, DIFFEQ_EDGES, 6) == [2] * 5 + [3, 3, 4, 4, 4, 4]


def test_multicycle():
    # a two-step multiply feeds an add; a lone add can go anywhere
    delay = [2, 1, 1]
    edges = [(0, 1)]
    assert asap(3, delay, edges) == [1, 3, 1]
    assert alap(3, delay, edges, 3) == [1, 3, 3]
    assert alap(3, delay, edges, 5) == [3, 5, 5]
    assert alap(3, delay, edges, 2) is None
    assert latency_of(asap(3, delay, edges), delay) == 3


def test_cycle_rejected():
    with pytest.raises(ValueError):
        topological_order(3, [(0, 1), (1, 2), (2, 0)])
    with pytest.raises(ValueError):
        asap(2, [1, 1], [(0, 1), (1, 0)])


def test_against_longest_paths():
    rng = random.Random(5301)
    for _ in range(300):
        n = rng.randint(1, 9)
        delay, edges = random_dag(rng, n)
        early = asap(n, delay, edges)
        cp = latency_of(early, delay)
        assert cp == max(longest_to_sinks(n, delay, edges, v) for v in range(n))
        for v in range(n):
            assert early[v] == 1 + longest_from_sources(n, delay, edges, v)
        assert alap(n, delay, edges, cp - 1) is None
        for latency in (cp, cp + 2):
            late = alap(n, delay, edges, latency)
            for v in range(n):
                assert late[v] == latency + 1 - longest_to_sinks(n, delay, edges, v)
            assert latency_of(late, delay) == latency


def test_extremes_of_all_schedules():
    rng = random.Random(5302)
    for _ in range(120):
        n = rng.randint(1, 5)
        delay, edges = random_dag(rng, n, most=2)
        early = asap(n, delay, edges)
        cp = latency_of(early, delay)
        for latency in (cp, cp + 1):
            late = alap(n, delay, edges, latency)
            sched = list(feasible_schedules(n, delay, edges, latency))
            assert tuple(early) in sched and tuple(late) in sched
            for v in range(n):
                starts = {t[v] for t in sched}
                # the frame [ASAP, ALAP] is exactly the set of starts that some schedule uses
                assert starts == set(range(early[v], late[v] + 1))
        assert not list(feasible_schedules(n, delay, edges, cp - 1))

History

The earliest and latest start times of the jobs of a project are the forward and backward passes of the critical path method of Kelley and Walker (1959), and the slack of a job is the mobility of this page. High-level synthesis of the 1980s used the ASAP schedule for the least latency and the ALAP schedule as a priority. Paulin and Knight (1989) used the interval between the two as the time frame of an operation, the base of force-directed scheduling. De Micheli's book (1994) presents both schedules as scheduling without resource constraints.

References

  1. Giovanni De Micheli, Synthesis and Optimization of Digital Circuits, McGraw-Hill, 1994, Chapter 5, Scheduling Algorithms (the sections on scheduling without resource constraints, ASAP and ALAP, and mobility)
  2. Pierre G. Paulin and John P. Knight, Force-directed scheduling for the behavioral synthesis of ASICs, IEEE Transactions on Computer-Aided Design 8(6), 661 to 679, 1989, the time frames of the operations from the ASAP and ALAP schedules, and the differential equation example
  3. James E. Kelley Jr. and Morgan R. Walker, Critical-path planning and scheduling, Papers presented at the Eastern Joint IRE-AIEE-ACM Computer Conference, December 1959, the earliest and latest start times of the jobs of a project (general locator)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example