x-ref: https://discourse.julialang.org/t/jump-scip-error/93958/3
If I modify the code of
function MOI.Bridges.final_touch(
bridge::CountBelongsToMILPBridge{T,F},
model::MOI.ModelLike,
) where {T,F}
@warn "Final touch with $(typeof(model))"
@show bridge
I get
julia> model = Model(SCIP.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: SCIP
julia> @variable(model, 0 <= s <= 1, Bin)
s
julia> @variable(model, n)
n
julia> @constraint(model, s + n <= 1)
s + n ≤ 1.0
julia> @constraint(model, [n, s] in MOI.CountBelongs(2, Set([1])))
[n, s] ∈ MathOptInterface.CountBelongs(2, Set([1]))
julia> optimize!(model)
┌ Warning: Final touch with MathOptInterface.Bridges.LazyBridgeOptimizer{SCIP.Optimizer}
└ @ MathOptInterface.Bridges.Constraint ~/.julia/dev/MathOptInterface/src/Bridges/Constraint/bridges/count_belongs.jl:280
bridge = MathOptInterface.Bridges.Constraint.CountBelongsToMILPBridge{Float64, MathOptInterface.VectorOfVariables}(MathOptInterface.VectorOfVariables(MathOptInterface.VariableIndex[MathOptInterface.VariableIndex(2), MathOptInterface.VariableIndex(1)]), MathOptInterface.CountBelongs(2, Set([1])), MathOptInterface.VariableIndex[], MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}[])
┌ Warning: Final touch with MathOptInterface.Bridges.LazyBridgeOptimizer{SCIP.Optimizer}
└ @ MathOptInterface.Bridges.Constraint ~/.julia/dev/MathOptInterface/src/Bridges/Constraint/bridges/count_belongs.jl:280
bridge = MathOptInterface.Bridges.Constraint.CountBelongsToMILPBridge{Float64, MathOptInterface.VectorOfVariables}(MathOptInterface.VectorOfVariables(MathOptInterface.VariableIndex[MathOptInterface.VariableIndex(2), MathOptInterface.VariableIndex(1)]), MathOptInterface.CountBelongs(2, Set([1])), MathOptInterface.VariableIndex[MathOptInterface.VariableIndex(3), MathOptInterface.VariableIndex(4)], MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}[MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(2), MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(3), MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}(4)])
ERROR: MathOptInterface.DeleteNotAllowed{MathOptInterface.VariableIndex}: Deleting the index MathOptInterface.VariableIndex(3) cannot be performed: Can not delete variable while model contains constraints! You may want to use a `CachingOptimizer` in `AUTOMATIC` mode or you may need to call `reset_optimizer` before doing this operation if the `CachingOptimizer` is in `MANUAL` mode.
Stacktrace:
[1] delete(o::SCIP.Optimizer, vi::MathOptInterface.VariableIndex)
Why is final_touch called twice (!!) times? The first makes sense. To fix up the bridge for each constraint. The second doesn't, and it looks like we're reformulating the problem twice?
x-ref: https://discourse.julialang.org/t/jump-scip-error/93958/3
If I modify the code of
I get
Why is
final_touchcalled twice (!!) times? The first makes sense. To fix up the bridge for each constraint. The second doesn't, and it looks like we're reformulating the problem twice?