This will be fixed in the next release of MathOptInterface: [Bridges] fix deletion of a vector of constraints by odow · Pull Request #2072 · jump-dev/MathOptInterface.jl · GitHub
julia> using JuMP
julia> import HiGHS
julia> import Gurobi
julia> function main(optimizer, flag; bridges)
x_min = rand(100,100)
m = Model(optimizer; add_bridges = bridges)
set_silent(m)
@variable(m, x[1:100, 1:100])
@constraint(m, x_min_con, x .>= x_min)
@objective(m, Min, sum(x))
optimize!(m)
if flag
@time delete(m, vec(x_min_con))
else
@time delete.(m, x_min_con)
end
return
end
main (generic function with 1 method)
julia> main(Gurobi.Optimizer, true; bridges = true)
0.012051 seconds (157.68 k allocations: 3.723 MiB)
julia> main(Gurobi.Optimizer, false; bridges = true)
1.347333 seconds (148.70 k allocations: 3.319 MiB)
julia> main(HiGHS.Optimizer, true; bridges = true)
0.009889 seconds (119.25 k allocations: 3.745 MiB)
julia> main(HiGHS.Optimizer, false; bridges = true)
2.359132 seconds (204.63 k allocations: 1.362 GiB, 9.89% gc time)
julia> main(Gurobi.Optimizer, true; bridges = false)
0.011513 seconds (138.70 k allocations: 3.433 MiB)
julia> main(Gurobi.Optimizer, false; bridges = false)
1.334790 seconds (148.70 k allocations: 3.319 MiB)
julia> main(HiGHS.Optimizer, true; bridges = false)
0.010266 seconds (119.25 k allocations: 3.745 MiB)
julia> main(HiGHS.Optimizer, false; bridges = false)
2.403712 seconds (204.63 k allocations: 1.362 GiB, 9.84% gc time)