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
16 changes: 16 additions & 0 deletions src/Test/UnitTests/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,19 @@ function solve_objbound_edge_cases(model::MOI.ModelLike, config::TestConfig)
end
end
unittests["solve_objbound_edge_cases"] = solve_objbound_edge_cases

function solve_unbounded_model(model::MOI.ModelLike, config::TestConfig)
MOI.empty!(model)
x = MOI.add_variables(model, 5)
MOI.set(
model,
MOI.ObjectiveFunction{MOI.ScalarAffineFunction{Float64}}(),
MOI.ScalarAffineFunction(MOI.ScalarAffineTerm.(1.0, x), 0.0)
)
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
if config.solve
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == MOI.DUAL_INFEASIBLE
end
end
unittests["solve_unbounded_model"] = solve_unbounded_model
12 changes: 11 additions & 1 deletion test/Test/unit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ end
"solve_time",
"solve_zero_one_with_bounds_1",
"solve_zero_one_with_bounds_2",
"solve_zero_one_with_bounds_3"
"solve_zero_one_with_bounds_3",
"solve_unbounded_model"
])
MOI.empty!(model)
end
Expand Down Expand Up @@ -329,6 +330,15 @@ end
MOIT.solve_zero_one_with_bounds_2(mock, config)
MOIT.solve_zero_one_with_bounds_3(mock, config)
end

@testset "solve_unbounded_model" begin
MOIU.set_mock_optimize!(mock,
(mock::MOIU.MockOptimizer) -> begin
MOIU.mock_optimize!(mock, MOI.DUAL_INFEASIBLE)
end
)
MOIT.solve_unbounded_model(mock, config)
end
end

@testset "modifications" begin
Expand Down