Closed felipemarkson closed 1 year ago
This issue is related to #177. Please note that Alpine currently only reformulates a nonconvex quadratic constraint, like in x^2 >= 1
into a relaxed quadratic constraint and hands it over to a convex MIP solver. As you mentioned, Alpine does not do any outer-approximation at this point to handle this. Instead, please use Pavito as the underlying mip_solver
for Alpine. Patio is an open-source convex MIP solver with which you could also invoke Gurobi, HiGHS or Cbc. Here is an example: https://github.com/lanl-ansi/Alpine.jl/blob/c6da8b92cf34bc1c88c1f488285a90d63fd3df55/test/runtests.jl#L35 and https://github.com/lanl-ansi/Alpine.jl/blob/c6da8b92cf34bc1c88c1f488285a90d63fd3df55/test/test_algorithm.jl#L104
Thanks!
So, I suggest remove MILP solvers from the documentation. Or warning the user about this issue on the documentation as well.
@felipemarkson I agree that the docs should clearly mention this. Regarding the x^2 >= 1
constraint, note that Alpine reformulates this into a convex constraint and applies partitioning to capture the non-convex side of the constraint. This reformulated convex MIP shouldn't have any issue to be be able to solve in Pavito.
Sorry, It was my mistake!
You are right! Using Pavito instead of an pure MILP
should work
Here is the script to run your NLP using Pavito and Ipopt within Alpine, which runs fine.
using Alpine
using JuMP
using Ipopt
using Pavito
using HiGHS
function get_highs()
return JuMP.optimizer_with_attributes(
HiGHS.Optimizer,
"log_to_console" => false,
)
end
function get_pavito(mip_solver, cont_solver)
return optimizer_with_attributes(
Pavito.Optimizer,
MOI.Silent() => true,
"mip_solver" => mip_solver,
"cont_solver" => cont_solver
)
end
function get_ipopt()
return optimizer_with_attributes(
Ipopt.Optimizer,
MOI.Silent() => true,
"sb" => "yes",
)
end
mip_solver = get_pavito(get_highs(), get_ipopt())
nlp_solver = get_ipopt()
alpine = JuMP.optimizer_with_attributes(
Alpine.Optimizer,
"nlp_solver" => nlp_solver,
"mip_solver" => mip_solver,
"presolve_bt" => true,
"apply_partitioning" => true,
)
model = Model(alpine)
@variable(model, 0 <= x <= 10)
@NLconstraint(model, x^2 ≥ 1)
@NLobjective(model, Min, x^3)
JuMP.optimize!(model)
Thanks! this model works here!
Should I close this issue? Or is it a documentation issue?
Feel free to close it. Have made note for docs update.
When you are using an pure MILP solver, like
Cbc
orHiGHS
,Alpine
is not applying the appropriate relaxations on quadratic functions.The same issue is not found on
Gurobi
becauseGurobi
can handle with quadratic constraints.Bellow you can see a minimal reproducible example:
Here you can see the Error message:![image](https://user-images.githubusercontent.com/47871564/192584120-3aeea056-7945-468c-92ac-a3181ae4c3ba.png)