You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.
import Gurobi
import MathOptInterface
MOI = MathOptInterface
m = Gurobi.Optimizer()
x = MOI.add_variable(m)
# Create two linear constraints, wrapped in a single VectorAffineFunction constraint
n =2
c1 = MOI.add_constraint(m,
MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(2.0, x)], 0.0),
MOI.EqualTo(0.0)
)
# Add another linear constraint
c2 = MOI.add_constraint(m,
MOI.VectorAffineFunction(
[MOI.VectorAffineTerm(i, MOI.ScalarAffineTerm(1.0, x)) for i in1:n],
zeros(n)
), MOI.Zeros(n)
)
# Now create another variable
y = MOI.add_variable(m)
# Multi-row change# That Multirow should raise an error, because the output dimension of c1 is 2
MOI.modify(m, c2, MOI.MultirowChange(y, [(1, 1.1), (2, 2.2), (3, 3.3)]))
# The above call did not raise an error, and modified c1
MOI.get(m, MOI.ConstraintFunction(), c1)
It appears that MOI.modify with a MultirowChange ends up calling LQOI.change_matrix_coefficient!, which simply re-writes matrix coefficients without any checks.
In particular:
Other constraints can be over-written (cf example above)
Instead of changing coeff of variable j of the i-th output dimension of the vector-valued constraint, it changes coeff (i, j) of the whole problem's constraint matrix.
The text was updated successfully, but these errors were encountered:
I don't think multirow change has been utilised, so there are probably lots of bugs like this.
Note that the Gurobi wrapper is being re-written (jump-dev/Gurobi.jl#216), and it doesn't implement MultirowChange because it doesn't support VectorAffineFunctions.
The most helpful thing would be to add lots of tests to moi hitting various edge cases.
outputs
It appears that
MOI.modify
with aMultirowChange
ends up callingLQOI.change_matrix_coefficient!
, which simply re-writes matrix coefficients without any checks.In particular:
j
of thei
-th output dimension of the vector-valued constraint, it changes coeff(i, j)
of the whole problem's constraint matrix.The text was updated successfully, but these errors were encountered: