# EAGO unbounded variables

**URL:** https://discourse.julialang.org/t/eago-unbounded-variables/119865
**Category:** Optimization (Mathematical)
**Created:** [September 25, 2024, 12:59pm UTC](https://discourse.julialang.org/t/eago-unbounded-variables/119865 "2024-09-25T12:59:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kiki\_Van\_Elsen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kiki_van_elsen/32/212229_2.png) [@kiki\_Van\_Elsen](https://discourse.julialang.org/u/kiki_Van_Elsen)
#### Post date: [September 25, 2024, 12:59pm UTC](https://discourse.julialang.org/t/eago-unbounded-variables/119865/1 "2024-09-25T12:59:07Z")

</div>

Hello!

I want to run the following code:

```julia
function bivariate(solver, type)
    try
        #choose which solver you want to use
        m = Model(solver.Optimizer)

        #function we want to Optimize
        f(x1,x2) = -x1 -x2
        
        #Variables in the optimization model
        @variable(m, x1)
        @variable(m, x2)

        #use piecewiselinear to solve the probem and set method to the type of formulation you want to test
        #Logarithmic or MC
        z = piecewiselinear(m, 
        x1,
        x2,
        #start: step: stop
        0: 0.5: 1,
        0: 0.5: 1,
        (x1, x2) -> (-x1 - x2);
        method = type,
        )

        #constraints of the model 
        @constraint(m, (x1)^2 + (x2)^2 <= 1)
        @constraint(m, 0 <= x1 <= 2)
        @constraint(m, 0 <= x2 <= 2)

        #objective of the model 
        @objective(m, Min, z) 
        
        #optimize the model 
        optimize!(m)

        value_x1 = value.(x1)
        value_x2 = value.(x2)

        return true, value_x1, value_x2

    catch exeption 
        println(exeption.msg)
        value_x1 = "-"
        value_x2 = "-"
        return exeption.msg, value_x1, value_x2
    end
end

```

Whenever I select EAGO as solver, I get the following warning:

```julia
┌ Warning: At least one branching variable is unbounded. This will interfere with EAGO's global
│ optimization routine and may cause unexpected results. Bounds have been automatically
│ generated at +/- 1e10 for all unbounded variables, but tighter user-defined bounds are
│ highly recommended. To disable this warning and the automatic generation of bounds, use
│ the option `unbounded_check = false`.
└ @ EAGO C:\Users\kikiv\.julia\packages\E

```

However, I cannot find where there would be unbounded variables. Does pieceweiselinear introduce these?

Kind regards,  
Kiki

---

<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: [September 26, 2024, 5:40am UTC](https://discourse.julialang.org/t/eago-unbounded-variables/119865/2 "2024-09-26T05:40:34Z")

</div>

Hi @kiki_Van_Elsen, welcome to the forum 😄

Instead of:

```julia
        @variable(m, x1)
        @variable(m, x2)
        @constraint(m, 0 <= x1 <= 2)
        @constraint(m, 0 <= x2 <= 2)

```

do

```julia
        @variable(m, 0 <= x1 <= 2)
        @variable(m, 0 <= x2 <= 2)

```

Your version is equivalent to

```julia
        @variable(m, -Inf <= x1 <= Inf)
        @variable(m, -Inf <= x2 <= Inf)
        @constraint(m, 0 <= 1.0 * x1 + 0.0 <= 2)
        @constraint(m, 0 <= 1.0 * x2 + 0.0 <= 2)

```

JuMP adds variable bounds only if you specify them in `@variable`. We don’t interpret `@constraint(model, x >= 0)` as a variable bound, but as the linear constraint 1 x + 0 \ge 0.

Having said that, depending on the method you choose, `piecewiselinear` might also add unbounded variables.

---

<div class="post-metadata">

### Author: ![kiki\_Van\_Elsen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kiki_van_elsen/32/212229_2.png) [@kiki\_Van\_Elsen](https://discourse.julialang.org/u/kiki_Van_Elsen)
#### Post date: [September 27, 2024, 7:35am UTC](https://discourse.julialang.org/t/eago-unbounded-variables/119865/3 "2024-09-27T07:35:20Z")

</div>

Thank you so much!

I now no longer get a warning for the method :MC.  
Do you perhaps know why I still get the warning for the Logarithmic method? I do not immediately see what kind of unbounded variable is added there.

---

<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: [September 27, 2024, 7:52am UTC](https://discourse.julialang.org/t/eago-unbounded-variables/119865/4 "2024-09-27T07:52:39Z")

</div>

I’m not sure. I don’t know the details of the formulation inside PiecewiseLinearOpt.

Note that this is just a warning. You’re probably fine to ignore it.
