chkwon / PATHSolver.jl

provides a Julia wrapper for the PATH Solver for solving mixed complementarity problems
http://pages.cs.wisc.edu/%7Eferris/path.html
MIT License
50 stars 15 forks source link

Bounds Error solving model in v1.7.3 #106

Closed mitchphillipson closed 6 months ago

mitchphillipson commented 6 months ago

Description of Issue

Version 1.7.3 passes constraint names to the PATH solver. The issue is that this doesn't take into account when variables are created so there is an issue extracting the correct names. Additionally, this will throw an error if you define two variables but only use the second.

Example of the issue

To illustrate the issue, here is a very simple example.

using JuMP
using PATHSolver

M = Model(PATHSolver.Optimizer)

@variables(M, begin
    not_used_in_model>=0
    x>=0
end)

@constraint(M, x_bound,
    x^2 +2*x - 1 ⟂ x
)

optimize!(M)

This code runs on version 1.7.2 but not on 1.7.3. On 1.7.2 the solver makes reference to f([2]), referring to the second variable, but there is only one constraint which causes an error on 1.7.3.

Note that this will not error if x is defined before not_used_in_model.

odow commented 6 months ago

Hmm. We could throw a nicer error for this, or we could add 0 ⟂ not_used_in_model by default.

But PATH assumes that there is exactly one complementarity constraint for every variable. We do not omit variables which are not used in the model.

odow commented 6 months ago

See https://github.com/chkwon/PATHSolver.jl/pull/107. This is just my fault in #104

mitchphillipson commented 6 months ago

The error isn't really with PATH, it's pairing the variable index with the "correct" variable. The issue, I think, is here. Adding extra trivial constraints isn't the worst solution and is probably the easiest.

I'm sorry I'm not familiar enough with either MOI or the PATHSolver package to fix the issue outright.

odow commented 6 months ago

Already fixed in #107 :smile: