Shuhua
October 21, 2020, 9:05am
1
I am playing with Couenne for NLP optimization problems with JuMP and AmplNLWriter. After setting up these packages, I tried the toy example in Couenne’s documentation (section 5). For convenience, the problem is posted here.
My Julia code is shown below.
using JuMP, AmplNLWriter
model = Model(with_optimizer(AmplNLWriter.Optimizer, raw"C:\Users\Gao Shuhua\Downloads\couenne-win64/couenne.exe"))
@variable(model, 0<=x0<=10)
@variable(model, 0<=x1<=10)
@variable(model, y2, Bin)
@variable(model, y3, Bin)
@variable(model, y4, Bin)
@constraints(model, begin
y2 + x0 <= 1.6
y3 + 1.333*x1 <= 3
y4 - y3 - y2 <= 0
end)
@NLconstraint(model, x0^2 + y2 == 1.25)
@NLconstraint(model, x1^1.5 + 1.5*y3 == 3)
@objective(model, Min, 2*x0 + 3*x1 + 1.5*y2 + 2*y3 - 0.5*y4)
optimize!(model)
The last line optimize!(model)
displays the following information:
Couenne 0.5.7 -- an Open-Source solver for Mixed Integer Nonlinear Optimization
Mailing list: couenne@list.coin-or.org
Instructions: http://www.coin-or.org/Couenne
couenne:
ANALYSIS TEST: Error evaluating constraint 2: can't evaluate pow"(0,1.5).
and then terminated. The termination status is
termination_status(model) = MathOptInterface.OTHER_ERROR
objective_value(model) = NaN
In contrast, the problem has been solved successfully in the documentation. Is there anything wrong in my code, or did I missing anything? Thank you.
odow
October 21, 2020, 6:01pm
2
This error is coming from Couenne and not from JuMP/AmplNLWriter. Try passing a different starting point:
@variable(model, 0<=x1<=10, start = 1.0)
Alternatively, add a non-zero lower bound. This worked for me:
model = Model(() -> AmplNLWriter.Optimizer("/Users/Oscar/Desktop/couenne"))
@variable(model, 0<=x0<=10)
@variable(model, 0.00001 <= x1 <= 10, start = 1)
@variable(model, y2, Bin)
@variable(model, y3, Bin)
@variable(model, y4, Bin)
@constraints(model, begin
y2 + x0 <= 1.6
y3 + 1.333*x1 <= 3
y4 - y3 - y2 <= 0
end)
@NLconstraint(model, x0^2 + y2 == 1.25)
@NLconstraint(model, x1^1.5 + 1.5*y3 == 3)
@objective(model, Min, 2*x0 + 3*x1 + 1.5*y2 + 2*y3 - 0.5*y4)
optimize!(model)
Presumably AMPL does some pre-processing to fix things like this.
Shuhua
October 22, 2020, 2:05am
3
@odow . Thank you. Since couenne claims to be a global optimization, I thought the starting point did not matter.
Shuhua
October 22, 2020, 9:15am
4
Hi, @odow , may I ask you another question about global optimality? In short, how can we confirm we have found the global optima? For example, in the above toy example, the achieved “gap” in the displayed information is zero.
Lower bound: 7.66718
Upper bound: 7.66718 (gap: 0.00%)
However, if I check the termination status, I get
@show termination_status(model)
termination_status(model) = MathOptInterface.LOCALLY_SOLVED
i.e., “locally solved”.
In addition, I performed another experiment for which the true optima are known. Couenne succeeded to find the true optima with zero gap . However, the termination_status
is still LOCALLY_SOLVED
.
Shall we believe in the gap ?