## Complementarity.jl

Provides a modeling interface for mixed complementarity problems (MCP) and math programs with equilibrium problems (MPEC) via JuMP
Popularity
54 Stars
Updated Last
1 Year Ago
Started In
April 2016

# Complementarity.jl

This package provides modeling language for (1) mixed complementarity problems (MCP) and (2) mathematical programs with equilibrium problems (MPEC).

NOTE `@complmentarity` for MCP and `@complements` for MPEC.

## Mixed Complementarity Problems (MCP)

NOTE: The PATHSolver.jl has been completely rewritten between `v0.6.2` and `v1.1.0`. Now PATHSolver.jl provides both an interface to the PATH solver and an integration to JuMP, but only limited to linear problems at this moment. For nonlinear problems, you still need to use Complementarity.jl, which now also uses the new PATHSolver.jl as its solver. Most parts of Complementarity.jl remain the same, except how the solver options are passed.

MCP Documentation

``````F(x) ⟂ lb ≤ x ≤ ub
``````

A very simple example:

``````(x+2) x = 0,  x ≥ 0,   x+2 ≥ 0
``````
```using Complementarity, JuMP
m = MCPModel()
@variable(m, x >= 0)
@mapping(m, F, x+2)
@complementarity(m, F, x)
status = solveMCP(m)
@show result_value(x)```

## Mathematical Programs with Equilibrium Constraints (MPEC)

NOTE: For solving MPEC, JuMP.jl `v0.21` has started supporting complementarity constraints. At this moment, GAMS.jl and KNITRO support complementarity constraints.

MPEC Documentation

``````min  f(x)
s.t. g(x) ≤ 0
F(x) ⟂ lb ≤ x ≤ ub
``````

A very simple example:

``````min  x^3
s.t. (x+2) x = 0,  x ≥ 0,   x+2 ≥ 0
``````
```using JuMP, Ipopt, Complementarity
m = Model(solver=IpoptSolver())
@variable(m, x>=0)
@NLobjective(m, Min, x^3)
@complements(m, 0 <= x+2,   x >= 0)
solve(m)
@show getvalue(x)```

# Installation

`Pkg.add("Complementarity")`

This will also install a few other packages.

### Required Packages

View all packages