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
8 changes: 4 additions & 4 deletions src/Bridges/Variable/bridges/ZerosBridge.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@ end

function MOI.get(
::MOI.ModelLike,
::MOI.ConstraintDual,
attr::MOI.ConstraintDual,
::ZerosBridge{T},
) where {T}
return error(
msg =
"Unable to query the dual of a variable bound that was reformulated " *
"using `ZerosBridge`. This usually arises in conic solvers when a " *
"variable is fixed to a value. As a work-around, instead of creating " *
"a fixed variable using variable bounds like `p == 1`, add an affine " *
"equality constraint like `1 * p == 1` (or `[1 * p - 1,] in Zeros(1)`).",
)
"equality constraint like `1 * p == 1` (or `[1 * p - 1,] in Zeros(1)`)."
return throw(MOI.GetAttributeNotAllowed(attr, msg))
end

function MOI.get(
Expand Down
3 changes: 2 additions & 1 deletion test/Bridges/Variable/zeros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ function test_zeros()
@test MOI.get(bridged_mock, MOI.ConstraintDual(), c1) == 0.0
@test MOI.get(bridged_mock, MOI.ConstraintDual(), c2) == 1.0
attr = MOI.ConstraintDual()
err = ErrorException(
err = MOI.GetAttributeNotAllowed(
attr,
"Unable to query the dual of a variable bound that was reformulated " *
"using `ZerosBridge`. This usually arises in conic solvers when a " *
"variable is fixed to a value. As a work-around, instead of creating " *
Expand Down
Loading