diff --git a/src/Bridges/debug.jl b/src/Bridges/debug.jl index 6ee1df3611..68da5d4beb 100644 --- a/src/Bridges/debug.jl +++ b/src/Bridges/debug.jl @@ -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) @@ -156,7 +156,7 @@ 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) @@ -164,7 +164,7 @@ function add_unsupported(graph::Graph, node::ConstraintNode, 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) diff --git a/test/Bridges/lazy_bridge_optimizer.jl b/test/Bridges/lazy_bridge_optimizer.jl index 26767b1497..fece135cf1 100644 --- a/test/Bridges/lazy_bridge_optimizer.jl +++ b/test/Bridges/lazy_bridge_optimizer.jl @@ -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