Linear Complementarity Problem (LCP)

January 19, 2026 · View on GitHub

Attribution: This content is derived from "Contact Handling for Articulated Rigid Bodies Using LCP" by Jie Tan, Kristin Siu, and C. Karen Liu. The original PDF is preserved at docs/lcp.pdf.

Navigation: Index | Overview →

Definition

The Linear Complementarity Problem (LCP) is defined as:

Given ARn×nA \in \mathbb{R}^{n \times n} and bRnb \in \mathbb{R}^n, find xRnx \in \mathbb{R}^n such that:

w=Axbw = Ax - b w0w \geq 0 x0x \geq 0 xTw=0(complementarity condition)x^T w = 0 \quad \text{(complementarity condition)}

Note: Many references write the standard LCP as w=Ax+qw = Ax + q. DART uses the equivalent convention w=Axbw = Ax - b (i.e., b=qb = -q), matching the ODE-style Ax=b+wAx = b + w form used by the constraint solver.

The complementarity condition xTw=0x^T w = 0 means that for each index ii:

Either xi=0 OR wi=0 (or both)\text{Either } x_i = 0 \text{ OR } w_i = 0 \text{ (or both)}

This can also be written component-wise as:

For each i{1,,n}i \in \{1, \ldots, n\}: wi=(Axb)i0w_i = (Ax - b)_i \geq 0 xi0x_i \geq 0 xiwi=0x_i \cdot w_i = 0

Equivalent Formulations

Minimum Map Reformulation

x=min(x,Axb)x = \min(x, Ax - b)

where the minimum is taken component-wise.

Nonlinear Complementarity Problem (NCP)

F(x)=0where F(x)=min(x,Axb)F(x) = 0 \quad \text{where } F(x) = \min(x, Ax - b)

Variational Inequality (VI)

Find x0x \geq 0 such that: (Axb)T(yx)0for all y0(Ax - b)^T (y - x) \geq 0 \quad \text{for all } y \geq 0

Quadratic Programming (QP) - When A is Symmetric PD

minx12xTAxxTbsubject to x0\min_x \frac{1}{2} x^T A x - x^T b \quad \text{subject to } x \geq 0

Problem Variants

Standard LCP

The basic form as defined above with unbounded variables constrained to be non-negative.

Boxed LCP (BLCP)

LCP with box constraints on variables:

Find xx such that: lxul \leq x \leq u w=Axbw = Ax - b

For each ii:

  • If xi=lix_i = l_i, then wi0w_i \geq 0
  • If xi=uix_i = u_i, then wi0w_i \leq 0
  • If li<xi<uil_i < x_i < u_i, then wi=0w_i = 0

Typical bounds:

  • Lower: l0l \leq 0 (often -\infty or μN-\mu N for friction)
  • Upper: u0u \geq 0 (often ++\infty or +μN+\mu N for friction)

Mixed LCP (MLCP)

Combination of equality constraints and complementarity:

Find xx, zz such that: Ax+Bz+c=0(equality constraints)Ax + Bz + c = 0 \quad \text{(equality constraints)} w=Cx+Dz+ew = Cx + Dz + e w0,z0w \geq 0, \quad z \geq 0 zTw=0(complementarity)z^T w = 0 \quad \text{(complementarity)}

LCP with Friction (FLCP)

Special BLCP where bounds depend on other variables:

For friction at contact ii: μNiFt,iμNi-\mu N_i \leq F_{t,i} \leq \mu N_i

where:

  • NiN_i is normal force
  • Ft,iF_{t,i} is tangential friction force
  • μ\mu is friction coefficient

In DART, this coupling is represented using the findex array:

  • For a tangential variable ii coupled to normal jj:
    • Set findex[i] = j
    • Store the coefficient in the box bounds: lo[i] = -μ, hi[i] = +μ
    • The effective bounds are interpreted as xiμxj|x_i| \leq \mu \cdot x_j

Applications in Physics-Based Simulation

1. Contact Mechanics

Unilateral Contact Constraints:

For each contact point ii: di0(non-penetration)d_i \geq 0 \quad \text{(non-penetration)} Ni0(no adhesion)N_i \geq 0 \quad \text{(no adhesion)} Nidi=0(complementarity: either separated or in contact)N_i \cdot d_i = 0 \quad \text{(complementarity: either separated or in contact)}

where:

  • did_i = gap distance (signed distance function)
  • NiN_i = normal contact force

LCP Formulation: After time discretization and linearization:

x=[N1,N2,,Nn]T(normal forces)x = [N_1, N_2, \ldots, N_n]^T \quad \text{(normal forces)}

AxbAx - b represents the constraint-space residual. Complementarity ensures forces are zero when separated.

2. Friction Modeling

Coulomb Friction as BLCP:

For contact ii with normal force NiN_i: Friction cone: Ft,iμNi\text{Friction cone: } \|F_{t,i}\| \leq \mu N_i

Discretized (pyramid approximation): μNiFt,ixμNi-\mu N_i \leq F_{t,i}^x \leq \mu N_i μNiFt,iyμNi-\mu N_i \leq F_{t,i}^y \leq \mu N_i

BLCP formulation: li=μNi,ui=+μNil_i = -\mu N_i, \quad u_i = +\mu N_i

3. Joint Limits

Joint Constraints:

For revolute joint with limits θminθθmax\theta_{\min} \leq \theta \leq \theta_{\max}:

BLCP formulation: l=θmin,u=θmaxl = \theta_{\min}, \quad u = \theta_{\max}

Forces active only at limits.

4. Rigid Body Dynamics

Time-Stepping Scheme:

Velocity-level formulation: M(v+v)=hfext+JTλM(v_+ - v_-) = h \cdot f_{\text{ext}} + J^T \lambda

where:

  • MM = mass matrix
  • vv_-, v+v_+ = velocities before/after contact
  • hh = time step
  • JJ = contact Jacobian
  • λ\lambda = contact impulses (LCP variable)

LCP emerges from non-penetration and friction constraints.

5. Fluid Simulation

Pressure Projection:

Incompressible flow with boundaries: u=0(divergence-free)\nabla \cdot u = 0 \quad \text{(divergence-free)} p0(pressure non-negative)p \geq 0 \quad \text{(pressure non-negative)} p(un)=0(complementarity)p \cdot (u \cdot n) = 0 \quad \text{(complementarity)}

Discretized → LCP for pressure field.

Mathematical Properties

Existence and Uniqueness

Theorem: An LCP has a unique solution if AA is:

  • Strictly Copositive: xTAx>0x^T A x > 0 for all x0x \neq 0, x0x \geq 0
  • P-matrix: All principal minors are positive
  • Symmetric Positive Definite (PD): xTAx>0x^T A x > 0 for all x0x \neq 0

Common Cases:

  • Contact mechanics: A is often symmetric PSD (positive semi-definite)
  • Joint constraints may make A singular (PSD but not PD)

Solvability Classes

Matrix ClassSolution Exists?Solution Unique?Solvable By
Symmetric PDAlwaysYesAll methods
Symmetric PSDSometimesSometimesPivoting, iterative
P-matrixAlwaysYesPivoting
CopositiveSometimesSometimesDepends on b
GeneralSometimesSometimesTrial and error

Degeneracy

Strict Complementarity: For all ii, either xi>0x_i > 0 OR wi>0w_i > 0 (but not both zero)

Degeneracy: When xi=wi=0x_i = w_i = 0 for some ii

  • Makes active set identification difficult
  • Can slow convergence of iterative methods
  • Pivoting methods may cycle

Complexity

Computational Complexity

  • General LCP: NP-complete (worst case)
  • Special cases (symmetric PD): Polynomial time

Practical Complexity

For physics simulation with nn contact points:

  • Problem size: nn to $6n$ variables (normal + friction + bounds)
  • Matrix structure: Often sparse (O(kn)O(kn) non-zeros, kk small)
  • Time discretization: Solve LCP every time step

Standard Forms

Cottle-Dantzig Form

w=Mz+qw = Mz + q w0,z0w \geq 0, \quad z \geq 0 wTz=0w^T z = 0

Used in theoretical analysis and pivoting methods.

Physics Form

(Axb)0(Ax - b) \geq 0 x0x \geq 0 xT(Axb)=0x^T(Ax - b) = 0

Direct from physics constraints.

Optimization Form (A symmetric PD)

minxf(x)=12xTAx+xTbsubject to x0\min_x f(x) = \frac{1}{2} x^T A x + x^T b \quad \text{subject to } x \geq 0

KKT conditions → LCP

Relationship to Other Problems

Linear Programming (LP)

LPLCP\text{LP} \subset \text{LCP}

LP: mincTx\min c^T x subject to AxbAx \leq b, x0x \geq 0 can be reformulated as LCP.

Quadratic Programming (QP)

QP (with box constraints)LCP\text{QP (with box constraints)} \subset \text{LCP}

When AA is symmetric: LCP ↔ QP with non-negativity.

Optimization

KKT conditions of constrained optimization often lead to LCP/BLCP.

Game Theory

Nash equilibria in bimatrix games can be found by solving LCP.

Why LCPs Matter for DART

Core Use Cases

  1. Contact Resolution

    • Every contact point → LCP variables
    • Friction cones → BLCP bounds
    • Non-penetration → Complementarity
  2. Constraint Satisfaction

    • Joint limits → BLCP
    • Motor constraints → MLCP
    • Closed kinematic chains → MLCP
  3. Interactive Simulation

    • Real-time requires fast LCP solvers
    • Trade-off: speed vs accuracy
    • Iterative methods essential (O(n)O(n) per iteration)
  4. High-Fidelity Simulation

    • Accurate contact forces need tight tolerances
    • Newton methods or pivoting
    • O(n3)O(n^3) acceptable for off-line

Solver Requirements

RequirementMethod Choice
Real-time (30+ FPS)PGS, PSOR, BGS
High accuracyNewton, Pivoting
Large scenes (>1000 contacts)NNCG, PGS
Ill-conditionedPivoting, Interior Point
Parallel hardwareJacobi, Red-Black GS

Key Challenges

Numerical Challenges

  1. Ill-conditioning: Large mass ratios, thin objects
  2. Degeneracy: Multiple contacts at same point
  3. Sparsity: Must exploit for large problems
  4. Warm-starting: Critical for time-stepping

Modeling Challenges

  1. Friction cone discretization: Pyramid vs ellipse
  2. Time integration: Implicit vs explicit
  3. Constraint stabilization: Baumgarte, post-stabilization
  4. Regularization: Trade-off with physical accuracy

Implementation Challenges

  1. Matrix assembly: Efficient Jacobian computation
  2. Solver selection: Problem-dependent performance
  3. Parameter tuning: Tolerances, iterations, relaxation
  4. Robustness: Handling edge cases, degeneracies

Further Reading

Theory

  • Cottle, Pang, Stone (1992): "The Linear Complementarity Problem" - Comprehensive reference
  • Murty (1988): "Linear Complementarity, Linear and Nonlinear Programming" - Theoretical foundations

Physics-Based Animation

  • Erleben et al. (2017): "Numerical Methods for Linear Complementarity Problems in Physics-Based Animation" - Direct application to simulation
  • Baraff (1994): "Fast Contact Force Computation for Nonpenetrating Rigid Bodies" - Foundational paper

Optimization

  • Nocedal & Wright (1999): "Numerical Optimization" - QP and NCP connections
  • Ferris & Kanzow (2002): "Engineering and Economic Applications of Complementarity Problems" - Applied perspective

Next: Overview of LCP Solvers →