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
6 changes: 3 additions & 3 deletions src/Bridges/debug.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function add_unsupported(graph::Graph, edges::Vector{ObjectiveEdge},
end
function add_unsupported(graph::Graph, node::VariableNode,
variables, constraints, objectives)
if _dist(graph, node) != INFINITY
if _dist(graph, node) != INFINITY || node in variables
return
end
push!(variables, node)
Expand All @@ -156,15 +156,15 @@ function add_unsupported(graph::Graph, node::VariableNode,
end
function add_unsupported(graph::Graph, node::ConstraintNode,
variables, constraints, objectives)
if _dist(graph, node) != INFINITY
if _dist(graph, node) != INFINITY || node in constraints
return
end
push!(constraints, node)
add_unsupported(graph, graph.constraint_edges[node.index], variables, constraints, objectives)
end
function add_unsupported(graph::Graph, node::ObjectiveNode,
variables, constraints, objectives)
if _dist(graph, node) != INFINITY
if _dist(graph, node) != INFINITY || node in objectives
return
end
push!(objectives, node)
Expand Down
35 changes: 35 additions & 0 deletions test/Bridges/lazy_bridge_optimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,41 @@ Bridge graph with 1 variable nodes, 5 constraint nodes and 2 objective nodes.
(5) `MOI.ScalarQuadraticFunction{$T}`-in-`MOI.LessThan{$T}` constraints are bridged (distance 5) by MOIB.Constraint.QuadtoSOCBridge{$T}.
|1| objective function of type `MOI.ScalarQuadraticFunction{$T}` is bridged (distance 12) by MOIB.Objective.SlackBridge{$T,MOI.ScalarQuadraticFunction{$T},MOI.ScalarQuadraticFunction{$T}}.
|2| objective function of type `MOI.SingleVariable` is bridged (distance 1) by MOIB.Objective.FunctionizeBridge{$T}.
"""
end
bridged = MOIB.LazyBridgeOptimizer(model)
@testset "Exponential constraint" begin
F = MOI.VectorAffineFunction{T}
S = MOI.ExponentialCone
@test debug_string(MOIB.debug_supports_constraint, F, S) ==
"""
`MOI.VectorAffineFunction{$T}`-in-`MOI.ExponentialCone` constraints are not supported and cannot be bridged into supported constrained variables and constraints. See details below:
(1) `MOI.VectorAffineFunction{$T}`-in-`MOI.ExponentialCone` constraints are not supported because no added bridge supports bridging it.
"""
MOIB.add_bridge(bridged, MOIB.Constraint.VectorSlackBridge{T})
@test debug_string(MOIB.debug_supports_constraint, F, S) ==
"""
`MOI.VectorAffineFunction{$T}`-in-`MOI.ExponentialCone` constraints are not supported and cannot be bridged into supported constrained variables and constraints. See details below:
[1] constrained variables in `MOI.ExponentialCone` are not supported because no added bridge supports bridging it.
Cannot add free variables and then constrain them because free variables are bridged but no functionize bridge was added.
(1) `MOI.VectorAffineFunction{$T}`-in-`MOI.ExponentialCone` constraints are not supported because:
Cannot use `MOIB.Constraint.VectorSlackBridge{$T,MOI.VectorAffineFunction{$T},MOI.ExponentialCone}` because:
[1] constrained variables in `MOI.ExponentialCone` are not supported
(2) `MOI.VectorAffineFunction{$T}`-in-`MOI.Zeros` constraints are not supported
(2) `MOI.VectorAffineFunction{$T}`-in-`MOI.Zeros` constraints are not supported because no added bridge supports bridging it.
"""
MOIB.add_bridge(bridged, MOIB.Constraint.VectorFunctionizeBridge{T})
@test debug_string(MOIB.debug_supports_constraint, F, S) ==
"""
`MOI.VectorAffineFunction{$T}`-in-`MOI.ExponentialCone` constraints are not supported and cannot be bridged into supported constrained variables and constraints. See details below:
[1] constrained variables in `MOI.ExponentialCone` are not supported because no added bridge supports bridging it.
Cannot add free variables and then constrain them because:
(1) `MOI.VectorAffineFunction{$T}`-in-`MOI.ExponentialCone` constraints are not supported
(1) `MOI.VectorAffineFunction{$T}`-in-`MOI.ExponentialCone` constraints are not supported because:
Cannot use `MOIB.Constraint.VectorSlackBridge{$T,MOI.VectorAffineFunction{$T},MOI.ExponentialCone}` because:
[1] constrained variables in `MOI.ExponentialCone` are not supported
(2) `MOI.VectorAffineFunction{$T}`-in-`MOI.Zeros` constraints are not supported
(2) `MOI.VectorAffineFunction{$T}`-in-`MOI.Zeros` constraints are not supported because no added bridge supports bridging it.
"""
end
end
Expand Down