Complementarity.jl supports equality constraints?

Hello, I have been unable to finish my MCP model because I cant find the way to add a constraint that is an equality. When I try combining and adding that constraint as @constraint or @NLconstraint and the others with @mapping, it does not work.

Any advise would be great!

1 Like

Mixed complementarity problems don’t support equality constraints.

Did you try formulating as an MPEC?

Note that you need m = Model(Ipopt.Optimizer) instead of m = Model(solver=IpoptSolver()). I opened a PR to fix: Fix syntax in README by odow · Pull Request #65 · chkwon/Complementarity.jl · GitHub

If you’re still stuck, please provide reproducible code of what you’ve tried so far: Please read: make it easier to help you

1 Like

Thank you. By using this solver Ipopt.Optimizer, Path cant be used to solve the model? My model has over 1000 variables …

If you want to use PATH, you’d have to reformulate your problem as a MCP, for example, by adding a dual variable:

using JuMP, PATHSolver
model = Model(PATHSolver.Optimizer)
@variable(model, x)
@variable(model, μ)
# @constraint(model, 2x == 1)
@constraint(model, 2x - 1 ⟂ μ)
solution_summary(model; verbose = true)

but you might need to be a bit careful, depending on the formulation of rest of your model. (In the model above, there’s effectively a hidden constraint that @constraint(model, 0 * x ⟂ x).)

Ipopt will have no trouble with 1000 variables.