# Solving nonlinear constrained optimization problem

**URL:** <https://discourse.julialang.org/t/solving-nonlinear-constrained-optimization-problem/111255>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [March 6, 2024, 5:58pm UTC](https://discourse.julialang.org/t/solving-nonlinear-constrained-optimization-problem/111255 "2024-03-06T17:58:20Z")\
**Posts on this page:** 1\
**Showing post:** 9

<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:** [March 7, 2024, 6:17am UTC](https://discourse.julialang.org/t/solving-nonlinear-constrained-optimization-problem/111255/9 "2024-03-07T06:17:20Z")

</div>

> [@rtapia](#):
>
> I modified it to use @NLconstraint

Please don’t 😆 the `@NL` interface is now legacy (see [ANN: JuMP v1.15 is released](https://discourse.julialang.org/t/ann-jump-v1-15-is-released/103875)) and it should not be encouraged for new uses. Also, it means the constraint is added as a generic nonlinear constraint. If you use `@constraint` JuMP and Ipopt can detect it as quadratic.

> global x1 =value.(x);

Also, don’t use `global`. Return the value from the function with

```Julia
    return value.(x), JuMP.objective_value(model)

```

and then call it as

```julia
x1, obj = main(A)

```

> `model.xtol_rel = 1e-6;`

This I not valid JuMP syntax.

You can see the full list of Ipopt options here: [Ipopt: Ipopt Options](https://coin-or.github.io/Ipopt/OPTIONS.html#OPTIONS_REF)

The way to set an option is `set_attribute(model, "tol", 1e-6)`.

---

_[View the full topic](https://discourse.julialang.org/t/solving-nonlinear-constrained-optimization-problem/111255)._
