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/Constraint/bridges/interval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ function _split_dual_start(value)
end
end

function _split_dual_start(value::Vector)
lower = similar(value)
upper = similar(value)
function _split_dual_start(value::Vector{T}) where {T}
lower, upper = similar(value), similar(value)
for i in eachindex(value)
lower[i], upper[i] = _split_dual_start(value[i])
end
return lower, upper
end

function MOI.set(
Expand Down
28 changes: 28 additions & 0 deletions test/Bridges/Constraint/interval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,34 @@ function test_runtests()
return
end

function test_runtests_vector()
MOI.Bridges.runtests(
MOI.Bridges.Constraint.SplitIntervalBridge,
"""
variables: x
[x] in Zeros(1)
""",
"""
variables: x
[x] in Nonnegatives(1)
[x] in Nonpositives(1)
""",
)
MOI.Bridges.runtests(
MOI.Bridges.Constraint.SplitIntervalBridge,
"""
variables: x, y
[1.0 * x + 2.0, x + y] in Zeros(2)
""",
"""
variables: x, y
[1.0 * x + 2.0, x + y] in Nonnegatives(2)
[1.0 * x + 2.0, x + y] in Nonpositives(2)
""",
)
return
end

end # module

TestConstraintSplitInterval.runtests()