Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/Bridges/bridge_optimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,13 @@ function MOI.delete(b::AbstractBridgeOptimizer, ci::MOI.ConstraintIndex)
MOI.throw_if_not_valid(b, ci)
br = bridge(b, ci)
if is_variable_bridged(b, ci)
error(
"Cannot delete constraint index of bridged constrained",
" variables. Delete the scalar variable or the vector of",
" variables instead.",
throw(
MOI.DeleteNotAllowed(
ci,
"Cannot delete constraint index of bridged constrained " *
"variables. Delete the scalar variable or the vector of " *
"variables instead.",
),
)
else
delete!(Constraint.bridges(b), ci)
Expand Down
7 changes: 4 additions & 3 deletions test/Bridges/Variable/zeros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ function test_zeros()
MOI.Bridges.IndexInVector(2),
) === nothing

err = ErrorException(
"Cannot delete constraint index of bridged constrained variables. Delete" *
" the scalar variable or the vector of variables instead.",
err = MOI.DeleteNotAllowed(
cyz,
"Cannot delete constraint index of bridged constrained variables. " *
"Delete the scalar variable or the vector of variables instead.",
)
@test_throws err MOI.delete(bridged_mock, cyz)

Expand Down