# AmplNLWriter, NLexpression, can't evaluate pow('(0,0.45),

**URL:** <https://discourse.julialang.org/t/amplnlwriter-nlexpression-cant-evaluate-pow-0-0-45/26006>\
**Category:** Optimization (Mathematical)\
**Created:** [July 4, 2019, 9:13am UTC](https://discourse.julialang.org/t/amplnlwriter-nlexpression-cant-evaluate-pow-0-0-45/26006 "2019-07-04T09:13:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raminel](https://avatars.discourse-cdn.com/v4/letter/r/ea666f/32.png) [@Raminel](https://discourse.julialang.org/u/Raminel)\
**Post date:** [July 4, 2019, 9:13am UTC](https://discourse.julialang.org/t/amplnlwriter-nlexpression-cant-evaluate-pow-0-0-45/26006/1 "2019-07-04T09:13:41Z")

</div>

Hi all,

I am trying include a power expression in my objective function. and I get an error “can’t evaluate pow’(0,0.45)”, even though I forced my variables to start from 1e-20. Has anyone an idea why?

using JuMP  
using AmplNLWriter  
using Ipopt

m = Model(with\_optimizer(AmplNLWriter.Optimizer, /path\_to\_couenne.exe"))

@variable(m, x[1:NP, 1:NP] \>= 1e-20 )  
@variable(m, c[1:NP, 1:NC] \>= 1e-20)  
@variable(m, t[1:NP, 1:NP, 1:NT], Bin)  
@variable(m, 0\<= TP[1:NP, 1:NP] \<= 100)

@constraint(m, 0 .\<= Cmax - c)  
@constraint(m, 0 .\<= QP - x’\*QP)  
@constraint(m, 1 .\>= sum(x, dims=2))  
@constraint(m, 1 .== sum(t, dims=3))

.  
.  
.

@NLexpression(m, Di[i=1:NP, j=1:NP], 0.363 _(x[i,j]QP[i]/3600/hoursperday)^0.45rho^0.13_1000)  
@NLobjective(m, Min, sum((0.0008_Di[i,j]^2 + 0.002_Di[i,j])\*Dis[i,j] for i = 1:NP, j = 1:NP))

JuMP.optimize!(m)

---

<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:** [July 5, 2019, 1:33pm UTC](https://discourse.julialang.org/t/amplnlwriter-nlexpression-cant-evaluate-pow-0-0-45/26006/2 "2019-07-05T13:33:48Z")

</div>

Please read: [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757).

Particularly about formatting your code with triple-backticks, and providing a minimum working example (e.g., what is `QP`?). Also provide the full error.

The likely culprit is that `x[i,j] * QP[i] / 3600 / 24` is too small for Couenne’s numerical precision.

Does the error go away if you make the lower bounds a lot larger (e.g., `>= 0.1`)?

You could also think about rescaling the problem. For example, you could multiple the objective by 10\_000 to get some nicer numbers.

---

<div class="post-metadata">

**Author:** ![Raminel](https://avatars.discourse-cdn.com/v4/letter/r/ea666f/32.png) [@Raminel](https://discourse.julialang.org/u/Raminel)\
**Post date:** [July 8, 2019, 3:35pm UTC](https://discourse.julialang.org/t/amplnlwriter-nlexpression-cant-evaluate-pow-0-0-45/26006/3 "2019-07-08T15:35:04Z")

</div>

Thank you for the tips!
