# Basic JuMP Question

**URL:** <https://discourse.julialang.org/t/basic-jump-question/88451>\
**Category:** Optimization (Mathematical)\
**Created:** [October 8, 2022, 4:38pm UTC](https://discourse.julialang.org/t/basic-jump-question/88451 "2022-10-08T16:38:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![samerb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samerb/32/9242_2.png) [@samerb](https://discourse.julialang.org/u/samerb)\
**Post date:** [October 8, 2022, 4:38pm UTC](https://discourse.julialang.org/t/basic-jump-question/88451/1 "2022-10-08T16:38:50Z")

</div>

I’m just trying to get a feel for how to use JuMP.

I try

```julia
model = Model(optimizer_with_attributes(
            Ipopt.Optimizer))

f(x) = x^2

register(model, :f, 1, f; autodiff = true)

@variable(model, x)

@NLconstraint(model, x <= 5)

@NLobjective(model, Max, f(x))

using Printf

optimize!(model);
status = @sprintf("%s", JuMP.termination_status(model));
if (status=="LOCALLY_SOLVED")
    @show value(x);
    @show objective_value(model);
end

```

I get: `EXIT: Iterates diverging; problem might be unbounded.` Full output: [here](https://dpaste.org/Bjxzb).

I also tried changing the constraint to `@NLconstraint(model, x^3 <= 5)`, and that gave a solution at x^\*=0, which is wrong.

Can someone tell me what’s wrong? Thanks

---

<div class="post-metadata">

**Author:** ![jbytecode](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbytecode/32/17719_2.png) [@jbytecode](https://discourse.julialang.org/u/jbytecode)\
**Post date:** [October 8, 2022, 6:43pm UTC](https://discourse.julialang.org/t/basic-jump-question/88451/2 "2022-10-08T18:43:20Z")

</div>

The objective function is unbounded (when x gets bigger and bigger, the objective value also gets bigger in both negative and positive directions). What about adding the constraint

`@constraint(model, x >= 0)`

?
