Gurobi optimization
Awaiting user inputI am using Gurobi optimizer to solve an UC problem. However, when it tries to optimize the UC model, an error occurs as follows:
ERROR: Result index of attribute MathOptInterface.VariablePrimal(1) out of bounds. There are currently 0 solution(s) in the model.
Stacktrace:
[1] check_result_index_bounds
@ C:\Users\hj0959\.julia\packages\MathOptInterface\goW8i\src\attributes.jl:207 [inlined]
[2] get(model::Gurobi.Optimizer, attr::MathOptInterface.VariablePrimal, x::MathOptInterface.VariableIndex)
@ Gurobi C:\Users\hj0959\.julia\packages\Gurobi\EKa6j\src\MOI_wrapper\MOI_wrapper.jl:2872
[3] get(b::MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer}, attr::MathOptInterface.VariablePrimal, index::MathOptInterface.VariableIndex)
@ MathOptInterface.Bridges C:\Users\hj0959\.julia\packages\MathOptInterface\goW8i\src\Bridges\bridge_optimizer.jl:1195
[4] get(model::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, attr::MathOptInterface.VariablePrimal, index::MathOptInterface.VariableIndex)
@ MathOptInterface.Utilities C:\Users\hj0959\.julia\packages\MathOptInterface\goW8i\src\Utilities\cachingoptimizer.jl:911
[5] _moi_get_result(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, ::MathOptInterface.VariablePrimal, ::Vararg{Any})
@ JuMP C:\Users\hj0959\.julia\packages\JuMP\ptoff\src\optimizer_interface.jl:640
[6] get(model::Model, attr::MathOptInterface.VariablePrimal, v::VariableRef)
@ JuMP C:\Users\hj0959\.julia\packages\JuMP\ptoff\src\optimizer_interface.jl:680
[7] value(v::VariableRef; result::Int64)
@ JuMP C:\Users\hj0959\.julia\packages\JuMP\ptoff\src\variables.jl:1080
[8] value(v::VariableRef)
@ JuMP C:\Users\hj0959\.julia\packages\JuMP\ptoff\src\variables.jl:1079
[9] (::PGWOpt_UC.var"#82#85"{OrderedCollections.OrderedDict{Any, Any}})(::Tuple{PGWOpt_UC.Bus, Int64})
-
Hi Nina,
It seems that your model is infeasible and you cannot retrieve any solution. You would need to check whether the solver found a solution or not using the termination_status(model) function. If the model is infeasible, you can then use the compute_conflict!(model) function to find a subset of constraints that are responsible for infeasibility.
You can also check out the Julia community forum for any Julia-specific question.
Best regards,
Maliheh
0 -
Hi Maliheh,
I would like to thank you for your response. We implemented the commands you just mentioned. As you said the solver does not find any solution. would you please let me know how we can fix the error because it seems like it is related to the gurobi optimization.
Thank you,
Nina
0 -
Hi Nina,
To debug the error, we would need to reproduce it first. Could you please post a minimal reproducible example? Please follow the instructions as explained in this Stack Overflow post to create a minimal example.
Best regards,
Maliheh
0
Please sign in to leave a comment.
Comments
3 comments