Skip to content

Commit

Permalink
[Bridges] fix ConstraintDualStart for Constraint.SplitIntervalBridge (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Sep 20, 2023
1 parent 7f7a429 commit ad5242c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
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()

0 comments on commit ad5242c

Please sign in to comment.