Relating transcripted variable with original variable #352
-
I'm working with an =======================================
Academic License
(NOT FOR COMMERCIAL USE)
Artelys Knitro 13.2.0
=======================================
ERROR: Infeasible variable bound deduced from presolve.
Variable: x[3997] <==== THIS IS WHAT I NEED
deduced upper bound = 1.19067145110921e+01 is less than
deduced lower bound = 1.23712359239063e+01
EXIT: Problem determined to be infeasible with respect to variable bounds.
Final Statistics
----------------
Final objective value = 1.10033609600000e+07
Final feasibility error (abs / rel) = 2.22e+04 / 1.00e+00
Final optimality error (abs / rel) = 1.80e+308 / 1.80e+308
# of iterations = 0
# of CG iterations = 0
# of function evaluations = 0
# of gradient evaluations = 0
# of Hessian evaluations = 0
Total program time (secs) = 0.105 ( 0.016 CPU time)
Time spent in evaluations (secs) = 0.000
=============================================================================== how do I know the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Yes, the solver works with the transcribed JuMP/MOI model. We provide mappings from the infinite variables to the underlying transcribed JuMP variables, but not vice versa. However, it should be relatively easy to figure out in this case. To get the name of the variable which will let us know which infinite variable and support it corresponds to, we can try something like: using InfiniteOpt, KNITRO
inf_model = InfiniteModel(KNITRO.Optimizer)
# MODEL GOES HERE
jump_model = optimizer_model(inf_model)
knitro_idx = 3997 # assuming the x[3997] is a naming convention by KNITRO that corresponds to the MOI variable index
jump_vref = VariableRef(jump_model, MOI.VariableIndex(knitro_idx)
println(name(jump_vref)) Based on the printed name, we should find the name of the infinite variable and the corresponding support index. |
Beta Was this translation helpful? Give feedback.
-
Okay, so after a bit of back and forth with the formulation (removing what was necessary and so on) this is what I came up with. Fixing the battery capacity =======================================
Academic License
(NOT FOR COMMERCIAL USE)
Artelys Knitro 14.0.0
=======================================
Knitro presolver has deduced that constraint c[2726] cannot be satisfied.
EXIT: Problem determined to be infeasible with respect to constraint bounds.
Final Statistics
----------------
Final objective value = 3.04942460000000e+02
Final feasibility error (abs / rel) = 4.72e+00 / 1.00e+00
Final optimality error (abs / rel) = 1.80e+308 / 1.80e+308
# of iterations = 0
# of CG iterations = 0
# of function evaluations = 0
# of gradient evaluations = 0
# of Hessian evaluations = 0
Total program time (secs) = 0.047 ( 0.000 CPU time)
Time spent in evaluations (secs) = 0.000
=============================================================================== So instead of a variable the problem is in a constraint. The debug is quite easy but slightly different: using JuMP, MathOptInterface, Infi
model = InfiniteModel(KNITRO.Optimizer)
SolvePolicies!(model, data)
jump_model = optimizer_model(model)
julia> A JuMP Model
Minimization problem with:
Variables: 4609
Objective function type: AffExpr
`AffExpr`-in-`MathOptInterface.EqualTo{Float64}`: 3456 constraints
`AffExpr`-in-`MathOptInterface.GreaterThan{Float64}`: 384 constraints
`AffExpr`-in-`MathOptInterface.LessThan{Float64}`: 1152 constraints
`VariableRef`-in-`MathOptInterface.EqualTo{Float64}`: 1 constraint
`VariableRef`-in-`MathOptInterface.GreaterThan{Float64}`: 2688 constraints
`VariableRef`-in-`MathOptInterface.LessThan{Float64}`: 2688 constraints
Model mode: AUTOMATIC
CachingOptimizer state: ATTACHED_OPTIMIZER
Solver name: Knitro
knitro_idx = 2726; # <== the index we want
# we get the list of constraints
cst_jump = vcat([all_constraints(jump_model, i...) for i in list_of_constraint_types(jump_model)]...);
con_dict = Dict(con => optimizer_index(con).value for con in cst_jump); # and we relate it with the indeces in the optimizer
findall(i -> i==knitro_idx, con_dict) # find the constraints related to our c[2726]
julia>
3-element Vector{ConstraintRef{Model, C, ScalarShape} where C}:
SoCev[1,2](support: 37) <= 52.86749999999998
SoCev[1,1](support: 35) - SoCev[1,1](support: 36) + 0.25 d/dt[SoCev[1,1](t)](support: 36) == 0
SoCev[1,2](support: 37) >= 11.129999999999995 So, quite a silly modeling mistake of passing a driving power/energy requirement higher than the EV battery capacity. Eventhough the solution was easy I haven't seen many places were the full link of |
Beta Was this translation helpful? Give feedback.
Okay, so after a bit of back and forth with the formulation (removing what was necessary and so on) this is what I came up with.
The
latex_formulation(model)
is: