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
17 changes: 17 additions & 0 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,23 @@ function MOI.supports_constraint(
return true
end

function MOI.get(
::Optimizer,
::MOI.ConstraintBridgingCost{
MOI.VectorNonlinearFunction,
<:MOI.AbstractVectorSet,
},
)
# Must agree with `supports_constraint` above: the generic
# `MOI.get(::Optimizer, ::AbstractModelAttribute)` would otherwise forward
# this query to the inner model, which does not handle
# `VectorNonlinearFunction` and would return `Inf`. `LazyBridgeOptimizer`
# then sees `supports = true, cost = Inf` and treats the node as
# unreachable when building the bridge graph.
# See https://github.com/jump-dev/MathOptInterface.jl/pull/3001
return 0.0
end

function _expr(::Optimizer, v::Value)
return Constant(v)
end
Expand Down
19 changes: 19 additions & 0 deletions test/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,25 @@ function test_issue_564()
return
end

function test_constraint_bridging_cost_vector_nonlinear()
model = Convex.Optimizer(ECOS.Optimizer)
for S in (
MOI.Nonnegatives,
MOI.Nonpositives,
MOI.Zeros,
MOI.SecondOrderCone,
MOI.PositiveSemidefiniteConeTriangle,
MOI.ExponentialCone,
)
@test MOI.supports_constraint(model, MOI.VectorNonlinearFunction, S)
@test MOI.get(
model,
MOI.ConstraintBridgingCost{MOI.VectorNonlinearFunction,S}(),
) == 0.0
end
return
end

function test_scalar_nonlinear_function()
model = Convex.Optimizer(ECOS.Optimizer)
x = MOI.add_variable(model)
Expand Down
Loading