Skip to content
Open
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
24 changes: 24 additions & 0 deletions test/linproginterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,30 @@ function linprogsolvertest(solver::AbstractMathProgSolver, eps = Base.rtoldefaul
@test getconstrLB(m)[i] <= getconstrsolution(m)[i] + eps
@test getconstrsolution(m)[i] <= getconstrUB(m)[i] + eps
end

# Tests that getsolution is feasible when the problem is unbounded
# so that getsolution() + λ getunboundedray() is feasible for any λ >= 0
# See https://github.com/JuliaOpt/MathProgBase.jl/pull/144

# Max x
# s.t. x >= 1
# x unbounded
# y <= -1
loadproblem!(m, [1. 0.], [-Inf, -Inf], [Inf, -1], [1., 0.], [1], [Inf], :Max)
optimize!(m)
@test MathProgBase.status(m) == :Unbounded
x = MathProgBase.getsolution(m)
@test 1 <= x[1] + eps
@test x[2] <= -1 + eps

# See https://github.com/JuliaOpt/Gurobi.jl/issues/80
# Min y
# s.t. x >= 1
loadproblem!(m, [1. 0.], [-Inf, -Inf], [Inf, Inf], [0., 1.], [1.], [Inf], :Min)
optimize!(m)
@test MathProgBase.status(m) == :Unbounded
x = MathProgBase.getsolution(m)
@test 1 <= x[1] + eps
end


Expand Down