Infeasible or unbounded model

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] "

Read Solutions · JuMP

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

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.

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:

1 Like

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

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)
error(“The model was not solved correctly.”)
termination_status(ESTMODEL1::Model) " INFEASIBLE_OR_UNBOUNDED::TerminationStatusCode = 6"
dual_status(ESTMODEL1::Model) "NO_SOLUTION::ResultStatusCode = 0

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.

Okey! thank you I am doing that.