# LP having unbouded and bounded variables

**URL:** <https://discourse.julialang.org/t/lp-having-unbouded-and-bounded-variables/11494>\
**Category:** Optimization (Mathematical)\
**Created:** [June 7, 2018, 10:26am UTC](https://discourse.julialang.org/t/lp-having-unbouded-and-bounded-variables/11494 "2018-06-07T10:26:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayce\_ram](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jayce_ram/32/3977_2.png) [@jayce\_ram](https://discourse.julialang.org/u/jayce_ram)\
**Post date:** [June 7, 2018, 10:26am UTC](https://discourse.julialang.org/t/lp-having-unbouded-and-bounded-variables/11494/1 "2018-06-07T10:26:51Z")

</div>

I have been modelling a LP problem with ~ 50k variables. Some of them are bounded, the other ones can take any value, i.e., they are unbounded. I coded the objective function and constraints but at the end, I got this result:  
`WARNING: Not solved to optimality, status: Unbounded`  
and also, the constraints I have specified were not respected.  
I can understand that my problem has variables unbounded, but it also has variables bounded. Anyone knows how it’s possible? The solution was supposed to respect the constraints even though they are not specified for all the variables… Thanks in advance.

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [June 7, 2018, 10:49am UTC](https://discourse.julialang.org/t/lp-having-unbouded-and-bounded-variables/11494/2 "2018-06-07T10:49:00Z")

</div>

Without an example that people can run, there is not much any one here can do to help.

---

<div class="post-metadata">

**Author:** ![leethargo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leethargo/32/6004_2.png) [@leethargo](https://discourse.julialang.org/u/leethargo)\
**Post date:** [June 8, 2018, 7:21am UTC](https://discourse.julialang.org/t/lp-having-unbouded-and-bounded-variables/11494/3 "2018-06-08T07:21:11Z")

</div>

Maybe some variables do not appear in the constraints? The status `Unbounded` here refers to the objective value, not individual variables. That is, there is a direction in which the objective values keeps improving while staying feasible.

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [June 8, 2018, 7:44am UTC](https://discourse.julialang.org/t/lp-having-unbouded-and-bounded-variables/11494/4 "2018-06-08T07:44:18Z")

</div>

If the problem is unbounded, JuMP sets the value of the variables to the unbounded ray  
[https://github.com/JuliaOpt/JuMP.jl/blob/d3814460359b324afc47ac99a8342927b4082e32/src/solvers.jl#L227-L234](https://github.com/JuliaOpt/JuMP.jl/blob/d3814460359b324afc47ac99a8342927b4082e32/src/solvers.jl#L227-L234)  
The unbounded ray is not a feasible solution of the problem, it is a feasible solution of the problem where the constants are replaced by 0.  
For instance, for the problem

```julia
min x
s.t. y == 1

```

the unbounded rays is `u = (x=-1, y=0)` which is feasible for the problem

```julia
min x
s.t. y == 0

```

The reason is that the unbounded ray should be added to a feasible solution `z` (e.g. `z = (x=0, y=1)` to get a ray `z + a u` that is feasible for any `a >= 0` and for which the objective function tends to minus infinity when `a` tends to infinity.
