Skip to content

Commit

Permalink
Add [missing] test for integer variable
Browse files Browse the repository at this point in the history
  • Loading branch information
LebedevRI committed Aug 14, 2024
1 parent b8b3746 commit 81bc900
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/MINLPs/milp.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function milp(; solver = nothing)
m = JuMP.Model(solver)

@variable(m, 0 <= objvar <= 20, Int)
@objective(m, Min, objvar)

return m
end
11 changes: 11 additions & 0 deletions test/test_algorithm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1043,3 +1043,14 @@ end
@test isapprox(objective_value(m), 13; atol = 1e-4)
@test MOI.get(m, Alpine.NumberOfIterations()) == 0
end

@testset "Test integer variables" begin
test_solver = optimizer_with_attributes(
Alpine.Optimizer,
"nlp_solver" => IPOPT,
"mip_solver" => HIGHS,
"minlp_solver" => JUNIPER,
)
m = milp(solver = test_solver)
@test_throws "Alpine does not support MINLPs with generic integer (non-binary) variables yet!" JuMP.optimize!(m)
end

0 comments on commit 81bc900

Please sign in to comment.