Set of tools to model nonlinear continuous optimization model
extended with complementarity constraints:
The resulting model is called an MPCC.
This package also handles vanishing constraints (MPVC)
kink constraints
and switching constraints
Denote ∘ the componentwise product of two vectors.
This package extends the NLPModel API defined in NLPModels.jl. The role of NLPModels.jl is to define an API that users and solvers can rely on.
The package contains the basic tools to use the Stopping framework, and exports an MPCCStopping.
The simplest way to define an MPCCModel uses automatic differentiation:
using MPCC
f(x) = sum(x) # objective function
x0 = ones(6)
G(x) = [x[1]; x[3]]
H(x) = [x[2]; x[4]]
lccg, lcch = zeros(2), zeros(2)
lvar, uvar = fill(-10.0, size(x0)), fill(10.0, size(x0))
admpcc = ADMPCCModel(G, H, lccg, lcch, f, x0, lvar, uvar)The resulting is an instance of an AbstractMPCCModel with all capabilities of an AbstractNLPModel such as
x = rand(6)
grad(admpcc, x) # returns the gradient of the objective function
neval_grad(admpcc) # returns the number of evaluation of grad
reset!(admpcc) # reset the internal counterbut also exports functions to deal with complementarity constraints
x = rand(6)
(consG(admpcc, x), consH(admpcc, x))but also jac_G_structure, jac_H_structure, jac_G_coord, jac_H_coord, jGprod, jHprod, jGtprod, jHtprod, hGprod, hHprod.
It also possible to convert the problem as a classical nonlinear optimization model treating the complementarity constraint as a nonlinear inequalities
using NLMPCC as follows
nlp = NLMPCC(admpcc)so that
cons(nlp, x)returns a vector consisting of [c(x), G(x), H(x), G(x) ∘ H(x)].
If you use MPCC.jl in your work, please cite using the reference given in CITATION.cff.
If you want to make contributions of any kind, please first that a look into our contributing guide directly on GitHub or the contributing page on the website.
Tangi Migot 📆 🚧 📖 |