Complementarity.jl
provides a modeling interface for mixed complementarity problems (MCP) and math programs with equilibrium problems (MPEC) via JuMP
GitHub Stars
78
User Rating
Not Rated
Favorites
0
Views
24
Forks
19
Issues
6
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: Differences between PATHSolver.jl and Complementarity.jl:
- PATHSolver.jl provides a wrapper for the C API of the PATH solver.
- PATHSolver.jl also enables JuMP for solving MCP, but limited to linear problems.
- Complementarity.jl provides a JuMP extension for solving MCP, both linear and nonlinear, using the C API wrapper in PATHSolver.jl.
- This package provides a modeling and computational interface for solving Mixed Complementarity Problems (MCP): modeling by JuMP.jl and computing by PATHSolver.jl and NLsolve.jl. See the 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.
- For solving mathematical programs with equilibrium constraints (MPEC), this package provides an extension to JuMP.jl by providing a macro that accepts complementarity conditions as constraints. Then it reformulates the complementarity conditions as a set of equality and inequality constraints so that a nonlinear optimization solver such as Ipopt.jl can solve the problem. See the 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(Ipopt.Optimizer)
@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.
A blazingly fast, context-aware directory tree tool co-created by human and AI for optimal information density across multiple output formats. Smart Tree bridges the gap between human readability and AI token efficiency, providing fixed-width formats for parsing, ultra-compact modes for bandwidth optimization, and AI-specific formats. HEX MODE
The Optuna MCP Server is a Model Context Protocol (MCP) server designed to interact with Optuna APIs. This tool automates optimization and analysis, enabling interactive analysis using large language models (LLMs). By leveraging Optuna's powerful optimization capabilities, users can enhance the performance of complex models. It particularly strengthens integration with databases and APIs, catering to various use cases.