# NLopt with JuMP producing an error

**URL:** <https://discourse.julialang.org/t/nlopt-with-jump-producing-an-error/12063>\
**Category:** New to Julia\
**Created:** [June 29, 2018, 1:21pm UTC](https://discourse.julialang.org/t/nlopt-with-jump-producing-an-error/12063 "2018-06-29T13:21:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![myroslav](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/myroslav/32/7354_2.png) [@myroslav](https://discourse.julialang.org/u/myroslav)\
**Post date:** [June 29, 2018, 1:21pm UTC](https://discourse.julialang.org/t/nlopt-with-jump-producing-an-error/12063/1 "2018-06-29T13:21:54Z")

</div>

Hi,  
I am trying to minimize a function subject to two boundary constraints and a linear inequality constraint. Here is a simplified version of what I am trying to do

```julia
using JuMP
using NLopt
fopt2(bprime, pimortg) = bprime^2 + pimortg^2
m_p2 = JuMP.Model(solver=NLoptSolver(algorithm=:LN_COBYLA))
JuMP.@variable(m_p2, bprime >= 0)
JuMP.@variable(m_p2, pimortg >= 0.00008)
JuMP.register(m_p2,:fopt2,2,fopt2,autodiff = true)
JuMP.@NLobjective(m_p2, Min, fopt2(bprime,pimortg))
res = JuMP.solve(m_p2)

```

The minimum point should be 0 and 0.00008. However, when I run it I get the error

```julia
ArgumentError: invalid NLopt arguments

```

Same happens when I add the constraint

```julia
JuMP.@constraint(m_p2, -pimortg - 0.9709*bprime >=-0.03)

```

Again, the same error.

Overall both JuMP and NLopt work for other problems that I have, but not for this one.

Thanks for help,  
Myroslav

---

<div class="post-metadata">

**Author:** ![Humphrey\_Lee](https://avatars.discourse-cdn.com/v4/letter/h/a88e4f/32.png) [@Humphrey\_Lee](https://discourse.julialang.org/u/Humphrey_Lee)\
**Post date:** [April 29, 2021, 6:25am UTC](https://discourse.julialang.org/t/nlopt-with-jump-producing-an-error/12063/2 "2021-04-29T06:25:16Z")

</div>

@myroslav. I know this problem of yours was many years ago, but did you manage to solve the problem? If yes, would you mind sharing the solution for greater community learning? Thanks.
