diff --git a/examples/MINLPs/milp.jl b/examples/MINLPs/milp.jl index 488fbd57..10d5ef98 100644 --- a/examples/MINLPs/milp.jl +++ b/examples/MINLPs/milp.jl @@ -1,7 +1,9 @@ function milp(; solver = nothing) m = JuMP.Model(solver) - @variable(m, 0 <= objvar <= 20, Int) + @variable(m, objvar, Int) + #@variable(m, 0 <= objvar <= 20, Int) + @constraint(m, objvar in MOI.Interval(0.0, 20.0)) @objective(m, Min, objvar) return m diff --git a/src/MOI_wrapper/MOI_wrapper.jl b/src/MOI_wrapper/MOI_wrapper.jl index 8cd54ff6..4963f2e2 100644 --- a/src/MOI_wrapper/MOI_wrapper.jl +++ b/src/MOI_wrapper/MOI_wrapper.jl @@ -322,18 +322,6 @@ function MOI.add_constraint(model::Optimizer, vi::MOI.VariableIndex, set::SCALAR return MOI.ConstraintIndex{typeof(vi),typeof(set)}(vi.value) end -function MOI.supports_constraint( - ::Optimizer, - ::Type{MOI.VariableIndex}, - ::Type{MOI.Integer}, -) - return true -end - -function MOI.add_constraint(model::Optimizer, f::MOI.VariableIndex, set::MOI.Integer) - model.var_type_orig[f.value] = :Int - return MOI.ConstraintIndex{typeof(f),typeof(set)}(f.value) -end function MOI.supports_constraint( ::Optimizer, ::Type{MOI.VariableIndex}, diff --git a/src/main_algorithm.jl b/src/main_algorithm.jl index a5da7b67..9e00bd7b 100644 --- a/src/main_algorithm.jl +++ b/src/main_algorithm.jl @@ -97,10 +97,6 @@ function load!(m::Optimizer) # Populate data to create the bounding MIP model Alp.recategorize_var(m) # Initial round of variable re-categorization - :Int in m.var_type_orig && error( - "Alpine does not support MINLPs with generic integer (non-binary) variables yet!", - ) - # Solver-dependent detection Alp._fetch_mip_solver_identifier(m) Alp._fetch_nlp_solver_identifier(m) diff --git a/test/test_algorithm.jl b/test/test_algorithm.jl index 58554d7d..230b9ac8 100644 --- a/test/test_algorithm.jl +++ b/test/test_algorithm.jl @@ -1052,5 +1052,9 @@ end "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) + JuMP.optimize!(m) + + @test termination_status(m) == MOI.OPTIMAL + @test isapprox(objective_value(m), 0; atol = 1e-4) + @test MOI.get(m, Alpine.NumberOfIterations()) == 0 end