Originally posted by: MatthiasWalter
Dear Cplex community,
I have a question regarding the cplex.getValue() statement for an IloNumVar object (C++).
In my application I solve a linear program, then I query the value of the variables x[i] via cplex.getValue(x[i]) for i=1,…I. If the value of x[i] is equal to 0, I fix the variable to 0 via x[i].setUB(0.0). After this operation, when I query the value of the next variable x
i+1, Cplex will issue the error message „Cplex Error 1217: No solution exists“. Obviously, Cplex has to reoptimize the (modified) problem, before another query is possible.
I avoid the Error by first recording all the variables I want to fix and by fixing them after having queried all (and recorded some) variables.
I am wondering if it is possible to fix a variable to its current value (!) without loosing the possibility to query the values of this or other variables.
In some special applications such a possibility would save myself an extra call of cplex.solve().
I would be grateful for any advice.
Kind regards
Matthias Walter
#CPLEXOptimizers#DecisionOptimization