Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VectorOfVariable with indicator does not detect binary variable #191

Open
matbesancon opened this issue Mar 31, 2021 · 4 comments
Open

VectorOfVariable with indicator does not detect binary variable #191

matbesancon opened this issue Mar 31, 2021 · 4 comments

Comments

@matbesancon
Copy link
Member

From jump-dev/JuMP.jl#2167

When copying the indicator constraint, the binary is sometimes not already set (comes from copy_to not being ordered).

MWE from JuMP:

using JuMP
import SCIP
using LinearAlgebra: 

m = Model(with_optimizer(SCIP.Optimizer))
nl = 10

@variable(m, v[1:nl])
@variable(m, s[j=1:nl])
@variable(m, z[j=1:nl], Bin)

@assert all(JuMP.is_binary, z)

@constraint(m,
    indicator_ones[j=1:nl],
    [z[j], v[j]] in MOI.IndicatorSet{MOI.ACTIVATE_ON_ONE}(MOI.LessThan(0.0))
)
optimize!(m)

Tricky to reproduce without it because it is tied to each copying implementation

@odow
Copy link
Contributor

odow commented Mar 31, 2021

SCIP should set z[j] to binary when adding an indicator constraint, and then potentially error on optimize! if the user has not explicitly set z to be binary.

@matbesancon
Copy link
Member Author

not sure I follow, if we set z[j] to binary, how do you check that the user has done it themselves? Does the optimizer have to keep another copy? Or do you set binary with the SCIP lower-level API directly in the first phase?

@rschwarz
Copy link
Collaborator

rschwarz commented Apr 1, 2021

Yes, I think we would have to have to keep a copy of the explicit user-defined variable type/constraint.

This is already done partially, see MOI_wrapper.jl, but I don't remember the exact use case for that.

A similar case is that of second-order cone constraints. In SCIP, it's asserted that y is non-negative for a constraint of the form sqrt(sum x_i^2) <= y. Here, there's also the choice of "fixing" the bound for the user, or error to tell the user to do it themselves.

Maybe the friendliest way is to "fix" the bounds and variable types to meet SCIP expectations, but send warnings. This requires additional storage of variable information.

@matbesancon
Copy link
Member Author

matbesancon commented Oct 6, 2021

I can't seem to reproduce the incident anymore, neither with JuMP nor MOI directly.
It is very likely still there but makes it tricky to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants