Algorithm Search⌘K

Modeladvanced

Timed event graph

Also called timed marked graph.

A Petri net where each place has one input and one output transition and a holding time. With earliest firing, the firing times obey x(k) = A x(k-1) in max-plus algebra.

A timed event graph is a model of a system of repeated events that wait for each other, such as machines in a production line, stages of a pipeline, or actors in a dataflow program. It is a Petri net in which every place has exactly one transition that puts tokens into it and exactly one transition that takes tokens out, and in which each token must stay a fixed holding time in its place before it can be used. So there are no choices, only synchronization: each event happens as soon as all of its input conditions are ready. Under this earliest firing rule, the time of the kk-th occurrence of each event is the maximum, over its inputs, of an earlier time plus a delay. In max-plus algebra this is a linear recurrence x(k)=A⊗x(k−1)x(k) = A \otimes x(k-1), and the long-run period of the system is the eigenvalue of AA given by the max-plus eigenvalue theorem. The untimed version is called a marked graph; homogeneous synchronous dataflow graphs and the pipelines of latency-insensitive design are marked graphs.

The machine

Structure. There are nn transitions t1,…,tnt_1, \dots, t_n (the events) and a set of places (the conditions). Each place pp has one input transition tj(p)t_{j(p)}, one output transition ti(p)t_{i(p)}, a number mp≥0m_p \ge 0 of initial tokens and a holding time τp≥0\tau_p \ge 0. A token that enters pp can be used by ti(p)t_{i(p)} only τp\tau_p time units later. Tokens leave a place in the order they entered. Some authors put the delays on the transitions (firing times) instead of on the places; a transition delay can be moved to its output places, so the two forms are equivalent.

Time axis. Event driven. The state is the vector of daters x(k)∈Rnx(k) \in \mathbb{R}^n, where xi(k)x_i(k) is the time of the kk-th firing of tit_i. Firing itself takes no time.

Dynamics. Under the earliest firing rule, each transition fires as soon as every input place holds a token that has stayed its holding time. Then

xi(k)=max⁡p: i(p)=i(τp+xj(p)(k−mp)).x_i(k) = \max_{p:\ i(p) = i} \left(\tau_p + x_{j(p)}(k - m_p)\right).

A place with mp≥2m_p \ge 2 can be split into a chain of places with one token each, so assume mp∈{0,1}m_p \in \{0, 1\}. Let A0A_0 collect the zero-token places and A1A_1 the one-token places: (Am)ij(A_m)_{ij} is the largest τp\tau_p over the places from tjt_j to tit_i with mp=mm_p = m, and ε=−∞\varepsilon = -\infty if there is none. Then

x(k)=A0⊗x(k)⊕A1⊗x(k−1).x(k) = A_0 \otimes x(k) \oplus A_1 \otimes x(k-1).

Standing assumption. Every circuit of places carries at least one token. Then the graph of A0A_0 has no circuit, its star A0∗=E⊕A0⊕⋯⊕A0⊗(n−1)A_0^* = E \oplus A_0 \oplus \cdots \oplus A_0^{\otimes(n-1)} is finite, and

x(k)=A⊗x(k−1),A=A0∗⊗A1.x(k) = A \otimes x(k-1), \qquad A = A_0^* \otimes A_1.

The initial condition x(0)x(0) fixes when the initial tokens become available: the token of a one-token place from tjt_j is available at xj(0)+τpx_j(0) + \tau_p. The proof is in proofs/correctness.md of this page. The computation of AA and of the daters is:

  1. TEG-MATRIX(n, places) ▷ place = (j, i, m, tau) with m ∈ {0, 1}
  2. 1A0 ← n by n matrix of ε; A1 ← n by n matrix of ε
  3. 2for each place (j, i, m, tau) do
  4. 3if m = 0 then A0[i][j] ← max(A0[i][j], tau) else A1[i][j] ← max(A1[i][j], tau)
  5. 4S ← A0* = E ⊕ A0 ⊕ ... ⊕ A0^(n-1) ▷ error if A0^n ≠ ε: a circuit without tokens
  6. 5A ← S ⊗ A1
  7. 6for k ← 1 to K do x(k) ← A ⊗ x(k-1)

Example 1. Two transitions. Place t1→t1t_1 \to t_1 holds 3, place t2→t2t_2 \to t_2 holds 4, place t2→t1t_2 \to t_1 holds 7 and place t1→t2t_1 \to t_2 holds 2; every place has one token. The self-loops say that a transition cannot fire again before its own processing time has passed. All places have one token, so A0=EA_0 = \mathcal{E}, A0∗=EA_0^* = E and

A=A1=[3724].A = A_1 = \begin{bmatrix} 3 & 7 \\ 2 & 4 \end{bmatrix}.

From x(0)=(0,0)x(0) = (0, 0) the daters are:

kk 0 1 2 3 4 5
x1(k)x_1(k) 0 7 11 16 20 25
x2(k)x_2(k) 0 4 9 13 18 22

For example, x1(2)=max⁡(3+7,7+4)=11x_1(2) = \max(3 + 7, 7 + 4) = 11: the second firing of t1t_1 waits for the token from the first firing of t2t_2. After the first step, each transition fires 9 time units every 2 firings, so the cycle time is 4.5, the mean of the circuit t1→t2→t1t_1 \to t_2 \to t_1 (holding times 2+72 + 7 over 2 tokens).

Example 2. A production line with one pallet. t1t_1 starts a part on machine 1, t2t_2 starts it on machine 2, t3t_3 releases it. The places are: t1→t1t_1 \to t_1 (machine 1 busy, 1 token, 3), t1→t2t_1 \to t_2 (the part moves on, 0 tokens, 3), t2→t2t_2 \to t_2 (machine 2 busy, 1 token, 4), t2→t3t_2 \to t_3 (0 tokens, 4) and t3→t1t_3 \to t_1 (the pallet returns, 1 token, 0). Here A0A_0 has the arcs t1→t2t_1 \to t_2 (3) and t2→t3t_2 \to t_3 (4), so A0∗A_0^* adds the path t1→t3t_1 \to t_3 of weight 7, and

A=A0∗⊗A1=[3ε06431087].A = A_0^* \otimes A_1 = \begin{bmatrix} 3 & \varepsilon & 0 \\ 6 & 4 & 3 \\ 10 & 8 & 7 \end{bmatrix}.

With x(0)=(−3,−4,0)x(0) = (-3, -4, 0), all initial tokens are available at time 0, and the daters are x(1)=(0,3,7)x(1) = (0, 3, 7), x(2)=(7,10,14)x(2) = (7, 10, 14), x(3)=(14,17,21)x(3) = (14, 17, 21). The single pallet makes the line sequential, and the cycle time is 3+4+0=73 + 4 + 0 = 7.

What it counts

The model predicts the time of every event under the earliest firing rule, from the holding times and the initial condition alone. The main derived quantities are:

  • The cycle time λ=lim⁡kxi(k)/k\lambda = \lim_k x_i(k)/k, the mean time between two firings of a transition in the long run, and the throughput 1/λ1/\lambda.
  • The critical circuits, the ones that reach the maximum in λ\lambda. They are the bottleneck: shortening a holding time off the critical circuits does not change λ\lambda.
  • Sojourn times of tokens in places and the transient before the periodic regime.

The model does not count resource use, costs or probabilities, and it does not decide between alternatives: a system with routing choices or with competition for a resource needs a general Petri net or another discrete event system model.

Relation to other models

  • A timed event graph is a Petri net without conflicts: since each place has one output transition, two transitions never compete for a token. The other special class, the state machine, has one input and one output arc per transition and models choice without synchronization.
  • Max-plus algebra is its algebra: the firing equations are linear there, as above. Counting the firings up to a time tt instead of timing the kk-th firing gives the dual, min-plus linear form (the counter description of Baccelli et al. 1992).
  • A homogeneous synchronous dataflow graph, where each actor consumes and produces one token per firing on each arc, is a marked graph; with execution times it is a timed event graph. Its throughput analysis is the cycle time analysis here.
  • The critical path method is the one-shot, acyclic case: each activity happens once, and the start times are the longest paths, given by the max-plus star.
  • Cyclic job shop scheduling with a fixed order of operations on each machine is a timed event graph. Choosing that order is the hard part, and it is outside the model.
  • Timed automata model time with clocks and allow choice; they are more expressive, and their questions are decided by state-space exploration rather than by linear algebra.

Known results in the model

  • Max-plus linearity. If every circuit has a token, x(k)=A0∗⊗A1⊗x(k−1)x(k) = A_0^* \otimes A_1 \otimes x(k-1) (Baccelli et al. 1992; proof on this page).
  • Liveness and token invariance. The number of tokens on each circuit never changes, since each transition on the circuit takes one token from the circuit and puts one back. A marked graph is live if and only if every circuit holds at least one token (Murata 1989, section on marked graphs).
  • Cycle time. If the graph of AA is strongly connected, every transition has the same cycle time λ\lambda. It is the maximum cycle mean of AA, and it equals the maximum over the circuits of the net of the sum of the holding times divided by the number of tokens on the circuit. This is the max-plus eigenvalue theorem, and Karp's algorithm computes λ\lambda in polynomial time.
  • Periodic regime. After a finite transient, x(k+c)=cλ+x(k)x(k + c) = c\lambda + x(k) for a cyclicity c≥1c \ge 1 (Cohen, Dubois, Quadrat and Viot 1985). In Example 1, c=2c = 2 and the transient is one step.
  • Reducible nets. If the graph is not strongly connected, the transitions can have different cycle times, given by the cycle time vector (Heidergott, Olsder and van der Woude 2006, Chapter 3).
Proof: The earliest firing times of a live timed event graph satisfy x(k) = A0* A1 x(k-1)full

A timed event graph has transitions t1,…,tnt_1, \dots, t_n and a set of places. Each place pp has one input transition tj(p)t_{j(p)}, one output transition ti(p)t_{i(p)}, mp∈{0,1}m_p \in \{0, 1\} initial tokens and a holding time τp≥0\tau_p \ge 0. Tokens leave a place in the order in which they entered it. Under the earliest firing rule, the kk-th firing of tit_i happens as soon as each input place of tit_i holds its kk-th token and that token has stayed its holding time. The initial token of a place with mp=1m_p = 1 counts as the output of a firing of tj(p)t_{j(p)} at a given time xj(p)(0)x_{j(p)}(0).

Notation is that of max-plus algebra, with ε=−∞\varepsilon = -\infty. Define A0,A1∈Rmax⁡n×nA_0, A_1 \in \mathbb{R}_{\max}^{n \times n} by

(Am)ij=max⁡{τp:j(p)=j, i(p)=i, mp=m},(A_m)_{ij} = \max \{\tau_p : j(p) = j,\ i(p) = i,\ m_p = m\},

with max⁡∅=ε\max \emptyset = \varepsilon.

Lemma 1: the firing equations

For k≥1k \ge 1, the firing times satisfy

x(k)=A0⊗x(k)⊕A1⊗x(k−1).x(k) = A_0 \otimes x(k) \oplus A_1 \otimes x(k-1).

Proof. Take a place pp from tjt_j to tit_i. Its tokens enter in the order of the firings of tjt_j: first the mpm_p initial tokens, then one token for each firing of tjt_j. So the kk-th token that tit_i takes from pp comes from the firing number k−mpk - m_p of tjt_j, where firing number 0 stands for the initial token. That token is available at xj(k−mp)+τpx_j(k - m_p) + \tau_p. The earliest firing rule fires tit_i for the kk-th time at the latest of these availability times over the input places of tit_i:

xi(k)=max⁡p: i(p)=i(τp+xj(p)(k−mp)).x_i(k) = \max_{p:\ i(p) = i} \left(\tau_p + x_{j(p)}(k - m_p)\right).

Grouping the places by mpm_p and by jj, and keeping only the largest holding time among parallel places, gives the matrix equation. □\square

Lemma 2: the star of an acyclic matrix

If the graph of A0A_0 has no circuit, then A0⊗n=EA_0^{\otimes n} = \mathcal{E} (the matrix with all entries ε\varepsilon), A0∗=E⊕A0⊕⋯⊕A0⊗(n−1)A_0^* = E \oplus A_0 \oplus \cdots \oplus A_0^{\otimes (n-1)}, and for every bb the equation x=A0⊗x⊕bx = A_0 \otimes x \oplus b has exactly one solution, x=A0∗⊗bx = A_0^* \otimes b.

Proof. (A0⊗n)ij(A_0^{\otimes n})_{ij} is the largest weight of a walk of length nn from jj to ii. Such a walk visits n+1n + 1 nodes, so it repeats one and contains a circuit, which does not exist. So no such walk exists and the entry is ε\varepsilon.

Existence: A0⊗A0∗⊗b⊕b=(A0⊕⋯⊕A0⊗n⊕E)⊗b=A0∗⊗bA_0 \otimes A_0^* \otimes b \oplus b = (A_0 \oplus \cdots \oplus A_0^{\otimes n} \oplus E) \otimes b = A_0^* \otimes b, because A0⊗n=EA_0^{\otimes n} = \mathcal{E}.

Uniqueness: let x=A0⊗x⊕bx = A_0 \otimes x \oplus b. Substituting the equation into itself nn times gives

x=A0⊗n⊗x⊕(E⊕A0⊕⋯⊕A0⊗(n−1))⊗b=A0∗⊗b.□x = A_0^{\otimes n} \otimes x \oplus (E \oplus A_0 \oplus \cdots \oplus A_0^{\otimes (n-1)}) \otimes b = A_0^* \otimes b. \qquad \square

Theorem

If the places with no initial token form no circuit, then for every x(0)x(0) and k≥1k \ge 1 the earliest firing times are x(k)=A⊗x(k−1)x(k) = A \otimes x(k-1) with A=A0∗⊗A1A = A_0^* \otimes A_1.

Proof. By Lemma 1, x(k)x(k) solves x=A0⊗x⊕bx = A_0 \otimes x \oplus b with b=A1⊗x(k−1)b = A_1 \otimes x(k-1). The zero-token places are exactly the arcs of the graph of A0A_0, so by hypothesis that graph has no circuit, and Lemma 2 gives x(k)=A0∗⊗A1⊗x(k−1)x(k) = A_0^* \otimes A_1 \otimes x(k-1). □\square

If the zero-token places form a circuit, no transition on it can ever fire, because each waits for a token from the one before it; the net is not live. The function mp_star detects this case by checking A0⊗n≠EA_0^{\otimes n} \ne \mathcal{E}, which by the argument of Lemma 2 holds exactly when the graph of A0A_0 has a circuit.

A place with mp≥2m_p \ge 2 tokens can be split into a chain of mpm_p places with one token each, joined by new transitions with holding time 0 on all but one place, so the restriction to mp∈{0,1}m_p \in \{0, 1\} loses no generality. The new transitions add entries to the state vector.

Cost

Building A0A_0 and A1A_1 takes one pass over the places. The star uses n−1n - 1 max-plus matrix products, plus one more for the circuit check, so O(n4)O(n^4) operations; a Floyd-Warshall style recursion would give O(n3)O(n^3). The product A0∗⊗A1A_0^* \otimes A_1 takes O(n3)O(n^3) and each step of the recurrence takes O(n2)O(n^2).

Code

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.

timed_event_graph.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/timed-event-graph/. The authors are listed in prov/KGRQ21.jsonl.

"""Timed event graphs as max-plus linear systems.

A timed event graph has n transitions t_0, ..., t_(n-1) and a list of places.
Each place is a tuple (j, i, m, tau): its one input transition is t_j, its one
output transition is t_i, it holds m initial tokens (0 or 1 here) and a token
must stay tau >= 0 time units in it before t_i can use it.

With the earliest firing rule, the time x_i(k) of the k-th firing of t_i is

    x_i(k) = max over places (j, i, m, tau) of tau + x_j(k - m).

Split the places by m: A0 holds the zero-token places, A1 the one-token
places. Then x(k) = A0 x(k) (+) A1 x(k-1) in max-plus notation, and if the
zero-token places form no circuit, x(k) = A x(k-1) with A = A0* A1.

The initial token of a one-token place (j, i, 1, tau) is treated as the
output of a firing of t_j at time x_j(0), so it is available at x_j(0) + tau.

Max-plus zero (epsilon) is float("-inf"). All arithmetic is exact for
integer holding times.
"""

EPS = float("-inf")

__all__ = ["EPS", "mp_mul", "mp_matvec", "mp_star", "teg_matrix", "simulate"]


def mp_mul(a, b):
    """Max-plus product of matrices given as lists of rows."""
    m = len(b)
    p = len(b[0])
    return [[max(row[k] + b[k][j] for k in range(m)) for j in range(p)] for row in a]


def mp_matvec(a, x):
    """Max-plus product of a matrix and a vector."""
    return [max(aij + xj for aij, xj in zip(row, x)) for row in a]


def mp_star(a):
    """Return a* = E (+) a (+) ... (+) a^(n-1) for a matrix whose graph has no circuit.

    Raise ValueError if the graph of a has a circuit, because then the
    zero-token places form a loop with no token and the net deadlocks.
    """
    n = len(a)
    s = [[0 if i == j else EPS for j in range(n)] for i in range(n)]
    p = [row[:] for row in s]
    for _ in range(n - 1):
        p = mp_mul(p, a)
        s = [[max(u, v) for u, v in zip(rs, rp)] for rs, rp in zip(s, p)]
    p = mp_mul(p, a)
    if any(v != EPS for row in p for v in row):
        raise ValueError("the zero-token places form a circuit: the net is not live")
    return s


def teg_matrix(n, places):
    """Return the n by n max-plus matrix A with x(k) = A x(k - 1)."""
    a0 = [[EPS] * n for _ in range(n)]  # @line L1
    a1 = [[EPS] * n for _ in range(n)]  # @line L1
    for j, i, m, tau in places:  # @line L2
        if tau < 0 or m not in (0, 1) or not (0 <= i < n and 0 <= j < n):
            raise ValueError("each place needs 0 or 1 token, tau >= 0 and valid transitions")
        if m == 0:  # @line L3
            a0[i][j] = max(a0[i][j], tau)  # @line L3
        else:  # @line L3
            a1[i][j] = max(a1[i][j], tau)  # @line L3
    s = mp_star(a0)  # @line L4
    return mp_mul(s, a1)  # @line L5


def simulate(a, x0, k):
    """Return [x(0), x(1), ..., x(k)] for x(k + 1) = A x(k)."""
    xs = [list(x0)]
    for _ in range(k):  # @line L6
        xs.append(mp_matvec(a, xs[-1]))  # @line L6
    return xs
test_timed_event_graph.py 183 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/timed-event-graph/. The authors are listed in prov/KGRQ21.jsonl.

import random
from collections import deque
from fractions import Fraction

import pytest

from timed_event_graph import EPS, mp_matvec, mp_mul, mp_star, simulate, teg_matrix

# Two transitions; every place holds one token.
TWO = [(0, 0, 1, 3), (1, 1, 1, 4), (1, 0, 1, 7), (0, 1, 1, 2)]

# A production line: t0 = start on machine 1, t1 = start on machine 2,
# t2 = the part leaves. One pallet circulates.
LINE = [
    (0, 0, 1, 3),  # machine 1 is busy 3 per part
    (0, 1, 0, 3),  # the part reaches machine 2 after 3
    (1, 1, 1, 4),  # machine 2 is busy 4 per part
    (1, 2, 0, 4),  # the part leaves after 4 on machine 2
    (2, 0, 1, 0),  # the pallet goes back to machine 1 at once
]


def token_game(n, places, x0, k, rng):
    """Fire enabled transitions in a random order; tokens leave places in FIFO order."""
    queues = [deque() for _ in places]
    for idx, (j, _, m, tau) in enumerate(places):
        if m == 1:
            queues[idx].append(x0[j] + tau)
    ins = [[idx for idx, p in enumerate(places) if p[1] == i] for i in range(n)]
    outs = [[idx for idx, p in enumerate(places) if p[0] == i] for i in range(n)]
    times = [[] for _ in range(n)]
    while True:
        ready = [i for i in range(n) if len(times[i]) < k and all(queues[idx] for idx in ins[i])]
        if not ready:
            break
        i = rng.choice(ready)
        t = max(queues[idx].popleft() for idx in ins[i])
        times[i].append(t)
        for idx in outs[i]:
            queues[idx].append(t + places[idx][3])
    return times


def elementary_circuit_means(a):
    """All circuit means of the graph of a, by brute force over simple paths."""
    n = len(a)
    means = []

    def dfs(start, node, weight, length, seen):
        for nxt in range(n):
            w = a[nxt][node]  # arc node -> nxt
            if w == EPS or nxt < start:
                continue
            if nxt == start:
                means.append(Fraction(weight + w) / (length + 1))
            elif nxt not in seen:
                dfs(start, nxt, weight + w, length + 1, seen | {nxt})

    for s in range(n):
        dfs(s, s, 0, 0, {s})
    return means


def strongly_connected(a):
    n = len(a)
    for s in range(n):
        seen, stack = {s}, [s]
        while stack:
            u = stack.pop()
            for v in range(n):
                if a[v][u] != EPS and v not in seen:
                    seen.add(v)
                    stack.append(v)
        if len(seen) < n:
            return False
    return True


def random_teg(rng, n):
    order = list(range(n))
    rng.shuffle(order)
    rank = {t: r for r, t in enumerate(order)}
    places = [(i, i, 1, rng.randint(0, 5)) for i in range(n)]
    for _ in range(rng.randint(n, 3 * n)):
        j, i = rng.randrange(n), rng.randrange(n)
        tau = rng.randint(0, 9)
        if rank[j] < rank[i] and rng.random() < 0.5:
            places.append((j, i, 0, tau))  # zero-token places follow the order, so they form no circuit
        else:
            places.append((j, i, 1, tau))
    return places


def test_two_transition_example():
    a = teg_matrix(2, TWO)
    assert a == [[3, 7], [2, 4]]
    xs = simulate(a, [0, 0], 5)
    assert xs == [[0, 0], [7, 4], [11, 9], [16, 13], [20, 18], [25, 22]]
    # cycle time 4.5 and cyclicity 2: A^4 = 9 + A^2
    a2 = mp_mul(a, a)
    a4 = mp_mul(a2, a2)
    assert a2 == [[9, 11], [6, 9]]
    assert a4 == [[v + 9 for v in row] for row in a2]
    assert max(elementary_circuit_means(a)) == Fraction(9, 2)


def test_production_line_uses_the_star():
    a = teg_matrix(3, LINE)
    assert a == [[3, EPS, 0], [6, 4, 3], [10, 8, 7]]
    xs = simulate(a, [-3, -4, 0], 3)
    assert xs[1] == [0, 3, 7]
    assert xs[2] == [7, 10, 14]
    assert xs[3] == [14, 17, 21]
    assert max(elementary_circuit_means(a)) == 7


def test_star_rejects_a_token_free_circuit():
    with pytest.raises(ValueError):
        teg_matrix(2, [(0, 1, 0, 1), (1, 0, 0, 1)])
    with pytest.raises(ValueError):
        teg_matrix(1, [(0, 0, 0, 2)])


def test_star_matches_longest_paths():
    rng = random.Random(5)
    for _ in range(50):
        n = rng.randint(1, 5)
        a = [[EPS] * n for _ in range(n)]
        for i in range(n):
            for j in range(i):
                if rng.random() < 0.5:
                    a[i][j] = rng.randint(-3, 6)  # arcs j -> i with j < i: acyclic
        s = mp_star(a)
        # longest path by dynamic programming in topological order
        for src in range(n):
            best = [EPS] * n
            best[src] = 0
            for v in range(src + 1, n):
                best[v] = max([best[u] + a[v][u] for u in range(src, v)] + [EPS])
            assert [s[v][src] for v in range(n)] == best


def test_recurrence_matches_token_game():
    rng = random.Random(2024)
    for _ in range(150):
        n = rng.randint(1, 5)
        places = random_teg(rng, n)
        a = teg_matrix(n, places)
        x0 = [rng.randint(-5, 5) for _ in range(n)]
        k = 12
        xs = simulate(a, x0, k)
        times = token_game(n, places, x0, k, rng)
        for i in range(n):
            assert times[i] == [xs[r][i] for r in range(1, k + 1)]


def test_cycle_time_is_the_maximum_cycle_mean():
    rng = random.Random(77)
    tested = 0
    for _ in range(200):
        n = rng.randint(1, 4)
        places = random_teg(rng, n)
        a = teg_matrix(n, places)
        if not strongly_connected(a):
            continue
        tested += 1
        lam = max(elementary_circuit_means(a))
        x0 = [rng.randint(-5, 5) for _ in range(n)]
        x = x0
        for _ in range(400):
            x = mp_matvec(a, x)
        # eventually periodic: x(k + c) = x(k) + c lam for some c
        y, found = x, False
        for c in range(1, 25):
            y = mp_matvec(a, y)
            if all(yi - xi == c * lam for xi, yi in zip(x, y)):
                found = True
                break
        assert found
    assert tested > 40

References

  1. François Baccelli, Guy Cohen, Geert Jan Olsder and Jean-Pierre Quadrat, Synchronization and Linearity, An Algebra for Discrete Event Systems, Wiley, 1992, the chapter on graph theory and Petri nets, and the chapters on the max-plus model of event graphs and its periodic regime
  2. Bernd Heidergott, Geert Jan Olsder and Jacob van der Woude, Max Plus at Work, Princeton University Press, 2006, Chapter 7, Petri Nets (timed event graphs and their max-plus equations); Chapter 3, the cycle-time vector
  3. Guy Cohen, Didier Dubois, Jean-Pierre Quadrat and Michel Viot, A linear-system-theoretic view of discrete-event processes and its use for performance evaluation in manufacturing, IEEE Transactions on Automatic Control AC-30(3), 210-220, 1985, the max-plus linear model of a manufacturing system and its cycle time
  4. Tadao Murata, Petri nets, properties, analysis and applications, Proceedings of the IEEE 77(4), 541-580, 1989, the section on marked graphs (liveness and the token count of circuits) and the section on timed nets

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 proofH2 full proof
  • correctness: no review record reviews/KGRQ21/proof-correctness.yaml
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)
WritingW4 complete
  • a review of the text: no review record reviews/KGRQ21/text.yaml