# Couenne with JuMP: can't evaluate pow"(0,1.5)

**URL:** <https://discourse.julialang.org/t/couenne-with-jump-cant-evaluate-pow-0-1-5/48734>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, couenne, nlp\
**Created:** [October 21, 2020, 9:05am UTC](https://discourse.julialang.org/t/couenne-with-jump-cant-evaluate-pow-0-1-5/48734 "2020-10-21T09:05:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shuhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuhua/32/27618_2.png) [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Post date:** [October 21, 2020, 9:05am UTC](https://discourse.julialang.org/t/couenne-with-jump-cant-evaluate-pow-0-1-5/48734/1 "2020-10-21T09:05:15Z")

</div>

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](https://github.com/coin-or/Couenne/blob/master/doc/couenne-user-manual.pdf) (section 5). For convenience, the problem is posted here.  
 ![couenne-example](https://global.discourse-cdn.com/julialang/original/3X/7/6/76c47d5f30f856c5da762c919a7cfcccbb523d64.png)  
My Julia code is shown below.

```julia
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:

```julia
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

```julia
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.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [October 21, 2020, 6:01pm UTC](https://discourse.julialang.org/t/couenne-with-jump-cant-evaluate-pow-0-1-5/48734/2 "2020-10-21T18:01:57Z")

</div>

This error is coming from Couenne and not from JuMP/AmplNLWriter. Try passing a different starting point:

```nohighlight
@variable(model, 0<=x1<=10, start = 1.0)

```

Alternatively, add a non-zero lower bound. This worked for me:

```nohighlight
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.

---

<div class="post-metadata">

**Author:** ![Shuhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuhua/32/27618_2.png) [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Post date:** [October 22, 2020, 2:05am UTC](https://discourse.julialang.org/t/couenne-with-jump-cant-evaluate-pow-0-1-5/48734/3 "2020-10-22T02:05:05Z")

</div>

@odow. Thank you. Since couenne claims to be a global optimization, I thought the starting point did not matter. 😂

---

<div class="post-metadata">

**Author:** ![Shuhua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shuhua/32/27618_2.png) [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Post date:** [October 22, 2020, 9:15am UTC](https://discourse.julialang.org/t/couenne-with-jump-cant-evaluate-pow-0-1-5/48734/4 "2020-10-22T09:15:52Z")

</div>

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.

```julia
Lower bound: 7.66718
Upper bound: 7.66718 (gap: 0.00%)

```

However, if I check the termination status, I get

```julia
@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_?
