-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
[Needs MOI 0.9.21] AffExpr in ZeroOne does not work #1943
[Needs MOI 0.9.21] AffExpr in ZeroOne does not work #1943
Comments
This issue has been a real difficulty in JuMP/MOI for me, using the latest versions (0.21.3 and 0.9.14). I would like to be able to constrain variables to integer or binary post-declaration, eg: using JuMP, MathOptInterface
m = Model()
@variable(m, x[1:3])
@constraint(m, x[1] in MathOptInterface.Integer()) I get an error in constructconstraint!. ERROR: MethodError: no method matching constructconstraint!(::JuMP.GenericAffExpr{Float64,Variable}, ::MathOptInterface.Integer)
Closest candidates are:
constructconstraint!(::JuMP.GenericAffExpr{Float64,Variable}, ::Any, ::Any) at
... I'm assuming these issues are related, since I tried the above example and got the same result. I work around right now as such, but I'd prefer not doubling up on variables. aux = @variable(m, [1:length(int_idxs)], Int);
@constraint(m, x[int_idxs] .== aux); Thanks for the help. |
Use |
I have a plan for this, but it requires: jump-dev/MathOptInterface.jl#1237. It has the added benefit of making it much more explicit when JuMP will push the function into the set. |
Accidentally closed by the MOI PR. |
MOI now has |
Wy don't we leave the constant in the functio' instead or returning an error? Then it can be bridged with a slack bridge |
That's what we do |
I missread the PR diff |
We should probably leave the constant in the function for these sets.
Reported by @jebouchat
The text was updated successfully, but these errors were encountered: