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: 1 addition & 5 deletions src/Bridges/vertical.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,12 @@ function _is_single_variable(func::MOI.ScalarAffineFunction)
iszero(func.constant)
end
function _is_single_variable(func::MOI.ScalarQuadraticFunction)
if (
return (
length(func.quadratic_terms) == 0 &&
length(func.affine_terms) == 1 &&
func.affine_terms[1].coefficient == 1.0 &&
iszero(func.constant)
)
return true
else
false
end
end
function _is_single_variable(func::MOI.ScalarNonlinearFunction)
return func.head == :+ && length(func.args) == 1 && isa(func.args[1], MOI.VariableIndex)
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,11 @@ end
S = MathOptComplements.ComplementsWithSetType{MOI.Nonnegatives}
@test MOI.Bridges.is_bridged(opt_nlp, S)
@test MOI.Bridges.supports_bridging_constrained_variable(opt_nlp, S)
@test MOI.Bridges.supports_bridging_constraint(
opt_nlp,
MOI.VectorAffineFunction{Float64},
S,
)
@test MOI.Bridges.bridge_type(opt_nlp, MOI.VectorAffineFunction{Float64}, S) ==
MathOptComplements.Bridges.NonlinearBridge{Float64,MOI.Nonnegatives}
# SOS1 path: VectorOfVariables in ComplementsWithSetType{Zeros} → ToSOS1Bridge
Expand Down
Loading