diff --git a/src/MOI_wrapper/MOI_wrapper.jl b/src/MOI_wrapper/MOI_wrapper.jl index 4a97ea9..8961c0b 100644 --- a/src/MOI_wrapper/MOI_wrapper.jl +++ b/src/MOI_wrapper/MOI_wrapper.jl @@ -338,7 +338,7 @@ mutable struct Optimizer <: MOI.AbstractOptimizer _INVERSE_HASH, ) model.next_column = 1 - model.last_constraint_index = 1 + model.last_constraint_index = 0 model.columns_deleted_since_last_update = Int[] model.affine_constraint_info = Dict{Int,_ConstraintInfo}() model.quadratic_constraint_info = Dict{Int,_ConstraintInfo}() diff --git a/test/MOI/MOI_wrapper.jl b/test/MOI/MOI_wrapper.jl index 0b18296..9bb0d59 100644 --- a/test/MOI/MOI_wrapper.jl +++ b/test/MOI/MOI_wrapper.jl @@ -870,6 +870,14 @@ function test_attribute_TimeLimitSec() return end +function test_last_constraint_index() + model = Gurobi.Optimizer(GRB_ENV) + x = MOI.add_variable(model) + c = MOI.add_constraint(model, 1.0 * x, MOI.GreaterThan(1.0)) + @test c.value == 1 + return +end + end TestMOIWrapper.runtests()