Closed lilianping closed 2 years ago
After making a few minor fixes, I tried your model with the latest versions of JuMP v0.23, Juniper v0.9, Ipopt v1.0 and it seemed to work.
I noticed in your example that you have optimizer = Alpine.Optimizer
This makes me wonder if this issue is related to that solver? If so please close this one and repost a working example at, https://github.com/lanl-ansi/Alpine.jl
Here is the code I tested,
using JuMP, Juniper, Ipopt
m = Model(Juniper.Optimizer)
set_optimizer_attribute(m, "nl_solver", optimizer_with_attributes(Ipopt.Optimizer, "tol"=>1e-4, "print_level"=>0))
@variable(m, objvar)
i_Idx = Any[1, 2]
@variable(m, 1 <= i[i_Idx] <= 5, Int)
@constraint(m, e1, -3*i[1] - 2*i[2] + objvar == 0.0)
@constraint(m, e2, -i[1]*i[2] <= -3.5)
@objective(m, Min, objvar)
println("Solving...")
optimize!(m)
solution_summary(m)
solution summary output,
julia> solution_summary(m)
* Solver : Juniper
* Status
Termination status : LOCALLY_SOLVED
Primal status : FEASIBLE_POINT
Dual status : FEASIBLE_POINT
Message from the solver:
"LOCALLY_SOLVED"
* Candidate solution
Objective value : 1.00000e+01
Objective bound : 1.00000e+01
* Work counters
Solve time (sec) : 2.18911e-01
After making a few minor fixes, I tried your model with the latest versions of JuMP v0.23, Juniper v0.9, Ipopt v1.0 and it seemed to work.
I noticed in your example that you have
optimizer = Alpine.Optimizer
This makes me wonder if this issue is related to that solver? If so please close this one and repost a working example at, https://github.com/lanl-ansi/Alpine.jlHere is the code I tested,
using JuMP, Juniper, Ipopt m = Model(Juniper.Optimizer) set_optimizer_attribute(m, "nl_solver", optimizer_with_attributes(Ipopt.Optimizer, "tol"=>1e-4, "print_level"=>0)) @variable(m, objvar) i_Idx = Any[1, 2] @variable(m, 1 <= i[i_Idx] <= 5, Int) @constraint(m, e1, -3*i[1] - 2*i[2] + objvar == 0.0) @constraint(m, e2, -i[1]*i[2] <= -3.5) @objective(m, Min, objvar) println("Solving...") optimize!(m) solution_summary(m)
solution summary output,
julia> solution_summary(m) * Solver : Juniper * Status Termination status : LOCALLY_SOLVED Primal status : FEASIBLE_POINT Dual status : FEASIBLE_POINT Message from the solver: "LOCALLY_SOLVED" * Candidate solution Objective value : 1.00000e+01 Objective bound : 1.00000e+01 * Work counters Solve time (sec) : 2.18911e-01
Thank you, I was originally using Julia1.6.1, after I updated to 1.7 and upgraded all the packages, it worked, and also, alpine appeared because I didn't find any relevant tutorials for juniper, so I was using alpine's Example learning, in the process of learning, after I used juniper to make an error, I used alpine to test it again. Is there any example of mixed integer nonlinear programming related to juniper? In addition, thank you again for your help
I am glad to hear it! I am going to close this issue because there is no known bug.
Regarding tutorials, Juniper supports almost any model that can be written in the JuMP modeling language. So I would suggest having a look at those. For example here are the ones on nonlinear programming, https://jump.dev/JuMP.jl/stable/tutorials/nonlinear/introduction/
If have you have suggestions for improving any aspect of the JuMP documentation you can post your ideas here, https://discourse.julialang.org/t/please-suggest-improvements-to-the-jump-documentation/55596
CC @odow
I got an error when doing mixed integer nonlinear optimization with juniper, so I did a small test, what is the problem?
this is code:
this is error: