Algorithm Search⌘K

Problemcore

Linear complementarity problem

Also called linear complementarity.

Given a matrix M and vector q, find z >= 0 with w = Mz + q >= 0 and z^T w = 0. Nash equilibria of bimatrix games are solutions of one.

The linear complementarity problem (LCP) asks: given an n×nn \times n matrix MM and a vector qq, find z≥0z \ge 0 such that w=Mz+q≥0w = Mz + q \ge 0 and ziwi=0z_i w_i = 0 for every ii. Each index is a switch with two states: either zi=0z_i = 0 and wiw_i is free to be positive, or wi=0w_i = 0 and ziz_i is free to be positive. In rigid-body simulation, ziz_i is the impulse (or force) at contact ii and wiw_i is the velocity at which the two bodies separate there: a contact can push but not pull, it pushes only if the bodies stay together, and MM says how the impulses at all the contacts change all the velocities (rigid contact complementarity). Physics engines often solve it approximately with projected Gauss-Seidel, and pivoting methods such as Lemke's algorithm solve it exactly. The same problem describes the optimality conditions of linear and quadratic programs and the Nash equilibria of two-player games. The general problem is NP-complete; what is easy or hard depends on the class of MM.

In plain words

There are nn pairs of numbers. In each pair both numbers must be zero or positive, and at least one of them must be zero. The second number of each pair is a fixed linear function of all the first numbers: a matrix times them, plus a vector. Find the first numbers. If you knew which member of each pair is zero, a linear system would give the answer. So the problem is a choice among 2n2^n patterns, and the matrix decides whether there is one answer, many, or none, and how hard it is to find.

Definition

LCP(q,M)(q, M). Input: M∈Qn×nM \in \mathbb{Q}^{n \times n} and q∈Qnq \in \mathbb{Q}^n. Find z∈Rnz \in \mathbb{R}^n with

z≥0,w=Mz+q≥0,zTw=0.z \ge 0, \qquad w = Mz + q \ge 0, \qquad z^{\mathsf T} w = 0 .

Because z≥0z \ge 0 and w≥0w \ge 0, the last condition is the same as ziwi=0z_i w_i = 0 for each ii. A vector zz with z≥0z \ge 0 and Mz+q≥0Mz + q \ge 0 is feasible; a feasible zz with zTw=0z^{\mathsf T} w = 0 is a solution. A short form is 0≤z⊥Mz+q≥00 \le z \perp Mz + q \ge 0.

For each set S⊆{1,…,n}S \subseteq \{1, \ldots, n\} the pattern "wi=0w_i = 0 for i∈Si \in S and zi=0z_i = 0 for i∉Si \notin S" gives the linear system MSSzS=−qSM_{SS} z_S = -q_S. A solution is a pattern whose system has a solution with zS≥0z_S \ge 0 and with the other entries of ww nonnegative. This gives a finite but exponential algorithm.

The class of MM decides the main properties.

class of MM definition what it gives
positive definite zTMz>0z^{\mathsf T} M z > 0 for z≠0z \ne 0 (not necessarily symmetric) a P-matrix: a unique solution for every qq; polynomial time
P-matrix every principal minor is positive a unique solution for every qq, and P-matrices are exactly the matrices with this property; Lemke's method finds it
positive semidefinite zTMz≥0z^{\mathsf T} M z \ge 0 for all zz if feasible, solvable; the solution set is convex; polynomial time by interior point methods
copositive-plus zTMz≥0z^{\mathsf T} M z \ge 0 for z≥0z \ge 0, and z≥0z \ge 0, zTMz=0z^{\mathsf T} M z = 0 imply (M+MT)z=0(M + M^{\mathsf T}) z = 0 if feasible, solvable, and Lemke's method finds a solution or proves infeasibility
strictly copositive zTMz>0z^{\mathsf T} M z > 0 for z≥0z \ge 0, z≠0z \ne 0 (for example M>0M > 0 entrywise) a solution for every qq; Lemke's method finds one
copositive zTMz≥0z^{\mathsf T} M z \ge 0 for z≥0z \ge 0 no guarantee by itself; the LCP of a bimatrix game has such an MM
general none deciding whether a solution exists is NP-complete

The statement that P-matrices are exactly the matrices for which LCP(q,M)(q, M) has a unique solution for every qq is a classical theorem of Samelson, Thrall and Wesler (1958).

Variants

  • Mixed LCP. Some variables are free and some rows are equations, as in the KKT conditions with equality constraints, or in contact with bilateral joints. It reduces to the standard form by splitting free variables or by eliminating them when their block is nonsingular.
  • Box-constrained LCP. Each ziz_i lies in an interval [ℓi,ui][\ell_i, u_i], and wiw_i has the sign that points into the box, or is 0 inside it. Physics engines use this form for friction with a bound proportional to the normal force.
  • Nonlinear complementarity problem. w=F(z)w = F(z) for a nonlinear map FF.
  • Variational inequality. Find zz in a convex set KK with (y−z)TF(z)≥0(y - z)^{\mathsf T} F(z) \ge 0 for all y∈Ky \in K; the LCP is the case K=R≥0nK = \mathbb{R}^n_{\ge 0} and F(z)=Mz+qF(z) = Mz + q.
  • Search versus decision. For P-matrices and strictly copositive matrices a solution always exists, so the problem is a total search problem; for general MM the question is whether a solution exists.

Examples

  • A block on the floor. One contact, unit mass, M=(1)M = (1). If the block moves down at speed 2, q=(−2)q = (-2) and the solution is z=2z = 2, w=0w = 0: the floor gives an impulse of 2 and the block stops. If it moves up at speed 1, q=(1)q = (1) and the solution is z=0z = 0, w=1w = 1: no impulse.
  • Two coupled contacts. M=(2112)M = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}, q=(−1,1)q = (-1, 1). The solution is z=(1/2,0)z = (1/2, 0) with w=(0,3/2)w = (0, 3/2); the worked pivots are on the Lemke's algorithm page.
  • No solution. M=(−1)M = (-1), q=(−1)q = (-1): w=−z−1<0w = -z - 1 < 0 for all z≥0z \ge 0.
  • Two solutions. M=(−1)M = (-1), q=(1)q = (1): z=0z = 0, w=1w = 1 and z=1z = 1, w=0w = 0 both work. MM is not a P-matrix, because its only principal minor is negative.
  • Bimatrix games. For an m×nm \times n game with positive payoff matrices AA and BB, the problem 0≤x⊥1−Ay≥00 \le x \perp \mathbf 1 - Ay \ge 0, 0≤y⊥1−BTx≥00 \le y \perp \mathbf 1 - B^{\mathsf T} x \ge 0 on the best response polytopes is an LCP whose solutions other than x=0x = 0, y=0y = 0, with xx and yy scaled to sum 1, are the Nash equilibria; the Lemke-Howson algorithm solves it.

Known algorithms

  • Enumeration of the 2n2^n patterns. Exact and exponential; useful as a reference for small nn.
  • Lemke's algorithm (1965). A complementary pivoting method with an artificial variable. It solves P-matrix, strictly copositive and copositive-plus problems, the last with a proof of infeasibility when it ends on a ray. Exponential in the worst case (Murty 1978).
  • Lemke-Howson algorithm (1964). The special case for bimatrix games, started from the artificial solution z=0z = 0 by dropping a label.
  • Principal pivoting methods. Murty's least index method and the Cottle-Dantzig method work on P-matrices and some other classes, without an artificial variable.
  • Iterative splitting methods. Projected Gauss-Seidel and projected SOR update one ziz_i at a time and clip it at 0. They converge for symmetric positive definite MM, and they are the usual choice in real-time physics, with a fixed number of sweeps.
  • Interior point methods. Polynomial time for positive semidefinite MM, where the LCP is a convex quadratic program.
  • Newton-type methods. Semismooth Newton methods on a reformulation such as the Fischer-Burmeister function, with fast local convergence.
AlgorithmTimeSpacePropertiesCode
Lemke's algorithmO(2^n n^3) worstO(n^2) extradeterministicexactofflineiterative1 language

Bounds

  • The general LCP is NP-complete: Chung (1989) showed that deciding whether a solution exists is NP-complete.
  • The LCP of a bimatrix game always has a nontrivial solution, and finding one is PPAD-complete, because it is the problem of finding a Nash equilibrium of a two-player game (Nash equilibrium computation).
  • For a P-matrix a solution always exists and is unique, and the problem is in the class CLS (Daskalakis and Papadimitriou, 2011); no polynomial-time algorithm is known.
  • For positive semidefinite MM the LCP is solvable in polynomial time, by interior point or ellipsoid methods for convex quadratic programs.
  • Complementary pivot methods take 2n2^n pivots on some LCPs of order nn (Murty 1978).

Reductions

  • Linear programming to LCP. The pair of LPs min⁡cTx\min c^{\mathsf T} x subject to Ax≥bAx \ge b, x≥0x \ge 0 and max⁡bTy\max b^{\mathsf T} y subject to ATy≤cA^{\mathsf T} y \le c, y≥0y \ge 0 has optimal solutions xx, yy exactly when z=(x,y)z = (x, y) solves the LCP with M=(0−ATA0)M = \begin{pmatrix} 0 & -A^{\mathsf T} \\ A & 0 \end{pmatrix} and q=(c,−b)q = (c, -b). This is complementary slackness, and MM is skew-symmetric, so it is positive semidefinite.
  • Convex quadratic programming to LCP. The KKT conditions of min⁡12xTQx+cTx\min \tfrac12 x^{\mathsf T} Q x + c^{\mathsf T} x subject to Ax≥bAx \ge b, x≥0x \ge 0, with QQ positive semidefinite, are the LCP with M=(Q−ATA0)M = \begin{pmatrix} Q & -A^{\mathsf T} \\ A & 0 \end{pmatrix}, q=(c,−b)q = (c, -b).
  • Bimatrix games to LCP. The example above is LCP(q,M)(q, M) with z=(x,y)z = (x, y), M=(0−A−BT0)M = \begin{pmatrix} 0 & -A \\ -B^{\mathsf T} & 0 \end{pmatrix} and q=1q = \mathbf 1. Because q≥0q \ge 0, the trivial solution z=0z = 0 is always there and gives no equilibrium; Lemke-Howson starts from it. The Lemke's algorithm page gives a different LCP with a positive MM and q=−1q = -\mathbf 1, on which Lemke's method with the all-ones covering vector always ends with an equilibrium.
  • Extensive-form games to LCP. With the sequence form, an equilibrium of a two-player game tree with perfect recall is a solution of an LCP of size linear in the tree.

Applications

  • Contact and friction in physics simulation. The impulses at the contacts of rigid bodies at each time step, with a linearized friction cone, solve an LCP (rigid contact complementarity). Cloth and particle contact give similar problems.
  • Game theory. Equilibria of two-player games in strategic and in extensive form.
  • Optimization. Linear and convex quadratic programs, through their optimality conditions.
  • Economics and engineering. Market equilibrium models, traffic equilibrium, and the analysis of structures with unilateral supports and of circuits with ideal diodes.

References

  1. Richard W. Cottle, Jong-Shi Pang and Richard E. Stone, The Linear Complementarity Problem, the problem, its sources (quadratic programs, bimatrix games, contact problems), the matrix classes and the pivoting and iterative methods
  2. Sung-Jin Chung, NP-completeness of the linear complementarity problem, Journal of Optimization Theory and Applications 60(3) (1989), 393-399, deciding whether an LCP has a solution is NP-complete
  3. C. E. Lemke, Bimatrix equilibrium points and mathematical programming, Management Science 11(7) (1965), 681-689, the LCP of a bimatrix game and the complementary pivot method for the general LCP
  4. Noam Nisan, Tim Roughgarden, Éva Tardos and Vijay V. Vazirani (eds.), Algorithmic Game Theory, Cambridge University Press, 2007, Chapter 3 (Bernhard von Stengel), the equilibria of a bimatrix game as the solutions of an LCP

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)
WritingW2 basic
  • a contract.yaml