Algorithm Search⌘K

Definitioncore

Max-plus algebra

Also called max-plus semiring, maxplus algebra.

The reals with minus infinity, where addition is max and multiplication is +. Matrix powers give longest paths, and timed synchronization becomes a linear system.

Max-plus algebra is the set Rmax⁡=R∪{−∞}\mathbb{R}_{\max} = \mathbb{R} \cup \{-\infty\} with the operations a⊕b=max⁡(a,b)a \oplus b = \max(a, b) and a⊗b=a+ba \otimes b = a + b. In this algebra, max plays the role of addition and ordinary addition plays the role of multiplication. Matrix products then compute longest paths in a weighted directed graph. Systems where an event waits for the last of several earlier events, such as a machine that starts when both of its input parts have arrived, become linear: x(k+1)=A⊗x(k)x(k+1) = A \otimes x(k). This is the basis of the timed event graph model and of the max-plus eigenvalue theorem. The min-plus algebra, with min and ++, is the same structure under x↦−xx \mapsto -x; it computes shortest paths and is the subject of min-plus matrix multiplication.

Definition

The max-plus semiring is Rmax⁡=(R∪{−∞},⊕,⊗,ε,e)\mathbb{R}_{\max} = (\mathbb{R} \cup \{-\infty\}, \oplus, \otimes, \varepsilon, e) with

a⊕b=max⁡(a,b),a⊗b=a+b,ε=−∞,e=0,a \oplus b = \max(a, b), \qquad a \otimes b = a + b, \qquad \varepsilon = -\infty, \qquad e = 0,

where −∞+a=−∞-\infty + a = -\infty for every aa. It satisfies these laws for all a,b,ca, b, c:

  • ⊕\oplus is associative and commutative, with zero element ε\varepsilon: a⊕ε=aa \oplus \varepsilon = a.
  • ⊗\otimes is associative and commutative, with unit element ee: a⊗e=aa \otimes e = a.
  • ⊗\otimes distributes over ⊕\oplus: a⊗(b⊕c)=(a⊗b)⊕(a⊗c)a \otimes (b \oplus c) = (a \otimes b) \oplus (a \otimes c), because a+max⁡(b,c)=max⁡(a+b,a+c)a + \max(b, c) = \max(a + b, a + c).
  • ε\varepsilon is absorbing for ⊗\otimes: a⊗ε=εa \otimes \varepsilon = \varepsilon.
  • ⊕\oplus is idempotent: a⊕a=aa \oplus a = a.

A semiring with an idempotent addition is called a dioid. Each a≠εa \ne \varepsilon has the multiplicative inverse −a-a, so Rmax⁡\mathbb{R}_{\max} is an idempotent semifield. The order a⪯b  ⟺  a⊕b=ba \preceq b \iff a \oplus b = b is the usual order of the reals. Powers are a⊗k=kaa^{\otimes k} = k a.

Matrices. For A,B∈Rmax⁡n×mA, B \in \mathbb{R}_{\max}^{n \times m} and C∈Rmax⁡m×pC \in \mathbb{R}_{\max}^{m \times p},

(A⊕B)ij=max⁡(Aij,Bij),(A⊗C)ij=max⁡k(Aik+Ckj).(A \oplus B)_{ij} = \max(A_{ij}, B_{ij}), \qquad (A \otimes C)_{ij} = \max_{k} \left(A_{ik} + C_{kj}\right).

The identity matrix EE has e=0e = 0 on the diagonal and ε\varepsilon elsewhere. Matrix ⊗\otimes is associative and distributes over ⊕\oplus, but it is not commutative.

The graph of a matrix. For a square A∈Rmax⁡n×nA \in \mathbb{R}_{\max}^{n \times n}, the precedence graph G(A)\mathcal{G}(A) has the nodes 1,…,n1, \dots, n and an arc from jj to ii with weight AijA_{ij} whenever Aij≠εA_{ij} \ne \varepsilon. (This follows Baccelli et al. 1992 and Heidergott et al. 2006; some books reverse the arcs.) By induction on kk,

(A⊗k)ij=the maximum weight of a path of length k from j to i,\left(A^{\otimes k}\right)_{ij} = \text{the maximum weight of a path of length } k \text{ from } j \text{ to } i,

and ε\varepsilon if there is no such path. AA is irreducible if G(A)\mathcal{G}(A) is strongly connected.

The star. A+=A⊕A⊗2⊕A⊗3⊕⋯A^+ = A \oplus A^{\otimes 2} \oplus A^{\otimes 3} \oplus \cdots and A∗=E⊕A+A^* = E \oplus A^+. If every circuit of G(A)\mathcal{G}(A) has weight at most 0, a longest path can skip every circuit, so the series stops: A∗=E⊕A⊕⋯⊕A⊗(n−1)A^* = E \oplus A \oplus \cdots \oplus A^{\otimes (n-1)} and (A+)ij(A^+)_{ij} is the weight of a longest path from jj to ii. If some circuit has positive weight, the entries on it grow without bound. When the star is finite, the equation x=A⊗x⊕bx = A \otimes x \oplus b has the least solution x=A∗⊗bx = A^* \otimes b.

Examples and non-examples

Scalars. 3⊕5=53 \oplus 5 = 5, 3⊗5=83 \otimes 5 = 8, 3⊕ε=33 \oplus \varepsilon = 3, 7⊗ε=ε7 \otimes \varepsilon = \varepsilon, 5⊗3=155^{\otimes 3} = 15 and (−2)⊗2=0=e(-2) \otimes 2 = 0 = e.

A matrix and its powers. Take

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

Its graph has a loop at node 1 with weight 3, a loop at node 2 with weight 4, an arc 2→12 \to 1 with weight 7 and an arc 1→21 \to 2 with weight 2. Then

A⊗2=[max⁡(3+3,7+2)max⁡(3+7,7+4)max⁡(2+3,4+2)max⁡(2+7,4+4)]=[91169].A^{\otimes 2} = \begin{bmatrix} \max(3+3, 7+2) & \max(3+7, 7+4) \\ \max(2+3, 4+2) & \max(2+7, 4+4) \end{bmatrix} = \begin{bmatrix} 9 & 11 \\ 6 & 9 \end{bmatrix}.

Entry (1,1)(1, 1) is the circuit 1→2→11 \to 2 \to 1 of weight 2+7=92 + 7 = 9, which beats twice the loop at node 1 (66). Further powers are A⊗3=[13161113]A^{\otimes 3} = \begin{bmatrix} 13 & 16 \\ 11 & 13 \end{bmatrix} and A⊗4=[18201518]=9⊗A⊗2A^{\otimes 4} = \begin{bmatrix} 18 & 20 \\ 15 & 18 \end{bmatrix} = 9 \otimes A^{\otimes 2}. The growth of 9 every two steps is the maximum cycle mean 4.54.5, as the max-plus eigenvalue theorem says.

A star. Let B=(−4.5)⊗A=[−1.52.5−2.5−0.5]B = (-4.5) \otimes A = \begin{bmatrix} -1.5 & 2.5 \\ -2.5 & -0.5 \end{bmatrix}. Its circuits have weights −1.5-1.5, −0.5-0.5 and 00, all at most 0, so B+=B⊕B⊗2=[02.5−2.50]B^+ = B \oplus B^{\otimes 2} = \begin{bmatrix} 0 & 2.5 \\ -2.5 & 0 \end{bmatrix} and B∗=B+B^* = B^+ (the diagonal is already 0).

A linear recurrence. With x(0)=(0,0)x(0) = (0, 0), the recurrence x(k+1)=A⊗x(k)x(k+1) = A \otimes x(k) gives x(1)=(7,4)x(1) = (7, 4), x(2)=(11,9)x(2) = (11, 9), x(3)=(16,13)x(3) = (16, 13). Read xi(k)x_i(k) as the time of the kk-th event at node ii: each event waits for the latest of its predecessors plus a delay. This is the timed event graph reading.

Non-examples.

  • (R,max⁡,+)(\mathbb{R}, \max, +) without −∞-\infty has no zero element for ⊕\oplus, so it is not a semiring in the sense above, and matrices cannot express a missing arc.
  • Rmax⁡\mathbb{R}_{\max} is not a ring: no element except ε\varepsilon has an additive inverse. If a⊕b=εa \oplus b = \varepsilon, then a=b=εa = b = \varepsilon. So the equation a⊕x=ba \oplus x = b has a solution only when a⪯ba \preceq b, and every x⪯bx \preceq b is a solution when a=ba = b. Methods that need subtraction, such as Gaussian elimination, do not carry over.
  • (R∪{±∞},max⁡,min⁡)(\mathbb{R} \cup \{\pm\infty\}, \max, \min) is the bottleneck algebra. It is a dioid too, but its matrix products compute widest paths, not longest paths.
  • The min-plus semiring (R∪{+∞},min⁡,+)(\mathbb{R} \cup \{+\infty\}, \min, +) is not a different theory: x↦−xx \mapsto -x maps it onto Rmax⁡\mathbb{R}_{\max}. The max-times semiring on the nonnegative reals is also isomorphic, through x↦log⁡xx \mapsto \log x.

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 max-plus algebra (dioids, matrices over R_max, the precedence graph and the star operation)
  2. Bernd Heidergott, Geert Jan Olsder and Jacob van der Woude, Max Plus at Work, Princeton University Press, 2006, Chapter 1, Max-Plus Algebra
  3. Raymond Cuninghame-Green, Minimax Algebra, Lecture Notes in Economics and Mathematical Systems 166, Springer, 1979, the algebra of max and plus on matrices, and the connection with longest paths

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 proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/E2XSG7/text.yaml