Skip to content

Commit a997872

Browse files
committed
Update
1 parent f9670d5 commit a997872

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

src/Bridges/Constraint/bridges/RSOCtoSOCBridge.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,8 @@ end
5959

6060
function MOI.Bridges.map_function(::Type{<:RSOCtoSOCBridge{T}}, func) where {T}
6161
scalars = MOI.Utilities.eachscalar(func)
62-
if length(scalars) < 2
63-
err = DimensionMismatch(
64-
"Unable to reformulate a `RotatedSecondOrderCone` into a " *
65-
"`SecondOrderCone` because the output dimension is too small",
66-
)
67-
throw(err)
68-
end
62+
# We cannot construct MOI.RotatedSecondOrderCone(1)
63+
@assert length(scalars) >= 2
6964
t, u, x = scalars[1], scalars[2], scalars[3:end]
7065
ts = MOI.Utilities.operate!(/, T, t, sqrt(T(2)))
7166
us = MOI.Utilities.operate!(/, T, u, sqrt(T(2)))

src/Bridges/Constraint/bridges/SOCtoPSDBridge.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,9 @@ end
256256

257257
function MOI.Bridges.map_function(::Type{<:RSOCtoPSDBridge{T}}, func) where {T}
258258
scalars = MOI.Utilities.eachscalar(func)
259-
if length(scalars) < 2
260-
err = DimensionMismatch(
261-
"Unable to bridge RotatedSecondOrderCone to PSD because the ",
262-
"dimension is too small: got $(length(scalars)), expected >= 2.",
263-
)
264-
throw(err)
265-
elseif length(scalars) == 2
259+
# We cannot construct MOI.RotatedSecondOrderCone(1)
260+
@assert length(scalars) >= 2
261+
if length(scalars) == 2
266262
return func
267263
end
268264
# Input is (t, u, x), and we need [t x'; x 2uI]

test/Bridges/Constraint/ScalarSlackBridge.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ function test_basis_status()
422422
MOI.set.(inner, MOI.VariableBasisStatus(), y, MOI.BASIC)
423423
@test MOI.get(model, MOI.ConstraintBasisStatus(), c) == MOI.BASIC
424424
d = MOI.add_constraint(model, 1.0 * x, MOI.Interval(1.0, 2.0))
425-
@test MOI.get(model, MOI.ConstraintBasisStatus(), c) == MOI.BASIC
425+
z = last(MOI.get(inner, MOI.ListOfVariableIndices()))
426+
MOI.set(inner, MOI.VariableBasisStatus(), z, MOI.SUPER_BASIC)
427+
@test MOI.get(model, MOI.ConstraintBasisStatus(), d) == MOI.SUPER_BASIC
426428
return
427429
end
428430

0 commit comments

Comments
 (0)