# Infeasible or unbounded model

**URL:** <https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [March 9, 2022, 10:02pm UTC](https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653 "2022-03-09T22:02:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dires](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@dires](https://discourse.julialang.org/u/dires)\
**Post date:** [March 9, 2022, 10:02pm UTC](https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653/1 "2022-03-09T22:02:44Z")

</div>

I got this message for my optimization problem can anybody help me how to resolve this?

"Result index of attribute MathOptInterface.ObjectiveValue(1) out of bounds. There are currently 0 solution(s) in the model.  
check\_result\_index\_bounds at attributes.jl:170 [inlined]  
get(model::Gurobi.Optimizer, attr::MathOptInterface.ObjectiveValue) at MOI\_wrapper.jl:3126  
\_moi\_get\_result(model::Gurobi.Optimizer, args::MathOptInterface.ObjectiveValue) at JuMP.jl:1126  
get(model::Model, attr::MathOptInterface.ObjectiveValue) at JuMP.jl:1154  
objective\_value(model::Model; result::Int64) at objective.jl:42  
objective\_value(model::Model) at objective.jl:42  
top-level scope at ETMODEL Stochastic3.jl:206  
eval at boot.jl:373 [inlined] "

---

<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 9, 2022, 11:08pm UTC](https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653/2 "2022-03-09T23:08:04Z")

</div>

Read [Solutions · JuMP](https://jump.dev/JuMP.jl/stable/manual/solutions/)

You need to check the various statuses to see if a solution exists.

---

<div class="post-metadata">

**Author:** ![dires](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@dires](https://discourse.julialang.org/u/dires)\
**Post date:** [March 9, 2022, 11:14pm UTC](https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653/3 "2022-03-09T23:14:04Z")

</div>

How can I do that?  
I was doing a Stochastic optimization problem with one uncertain variable, that works perfectly. Then I incorporate a second uncertain variable with a different number of scenarios. then I get the message.

---

<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 9, 2022, 11:55pm UTC](https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653/4 "2022-03-09T23:55:12Z")

</div>

> How can I do that?

Follow the examples in the documentation. Use `termination_status(model)` to check if the solver found an `OPTIMAL` solution.

If you’re still struggling after reading the documentation, please provide a reproducible example:

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

<div class="post-metadata">

**Author:** ![dires](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@dires](https://discourse.julialang.org/u/dires)\
**Post date:** [March 10, 2022, 10:32am UTC](https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653/5 "2022-03-10T10:32:11Z")

</div>

I just follow the example and here is what I get. it returned The model was not solved correctly.

"  
optimize!(ESTMODEL1)  
primal\_status(ESTMODEL1) " NO\_SOLUTION::ResultStatusCode = 0"  
if termination\_status(ESTMODEL1) == MOI.OPTIMAL  
optimal\_solution = value.(Z2)  
optimal\_objective = objective\_value(ESTMODEL1)

elseif termination\_status(ESTMODEL1) == MOI.TIME\_LIMIT && has\_values(ESTMODEL1)  
suboptimal\_solution = value.(Z2)  
suboptimal\_objective = objective\_value(ESTMODEL1)  
else  
error(“The model was not solved correctly.”)  
end  
termination\_status(ESTMODEL1::Model) " INFEASIBLE\_OR\_UNBOUNDED::TerminationStatusCode = 6"  
dual\_status(ESTMODEL1::Model) "NO\_SOLUTION::ResultStatusCode = 0  
"

---

<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 10, 2022, 8:58pm UTC](https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653/6 "2022-03-10T20:58:57Z")

</div>

Take another read of the “Please read” post. It describes how to format your code blocks.

The problem seems to be that the termination status was `INFEASIBLE_OR_UNBOUNDED`, which means that your problem doesn’t have a solution to query. You can also see that with the primal status of `NO_SOLUTION`.

If you expected your problem to have a finite optimal solution, then you should double check your formulation for mistakes.

---

<div class="post-metadata">

**Author:** ![dires](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@dires](https://discourse.julialang.org/u/dires)\
**Post date:** [March 10, 2022, 10:04pm UTC](https://discourse.julialang.org/t/infeasible-or-unbounded-model/77653/7 "2022-03-10T22:04:26Z")

</div>

Okey! thank you I am doing that.
