Originally posted by: Atefeh alizadeh
Hello,
I want to build a CPLEX model using Python where some of the parameters of the model change (NOT a sensitivity analysis) and each different value is dictated by information at a node of the BB. So, I do not want to build a model from ground up at each node, rather I want to pass a previously built model and just change a few parameters and solve it. Is it possible to introduce parameters in the model so that before solving it I just set the value of the parameter and CPLEX solves it? Or I need to build the whole model every time I have a different value for the parameters? The goal is to save time by avoiding to build the model every time a small number of parameters change.
I tried to solve this problem using following code:
cpx1 = cplex.Cplex()
# do stuff
cpx1.parameters.write_file('tmp.prm')
cpx1.write('tmp.sav')
cpx2 = cplex.Cplex()
cpx2.parameters.read_file('tmp.prm')
cpx2.read('tmp.sav')
because I could not find some thing like cpx2 = cpx1.copy() in Cplex and then I tried to modify the model at each node. but I get this error:
CPLEX Error 1219: No names exist.
Is there any other way to handle this or solve the error?
Thank you in advance
#CPLEXOptimizers#DecisionOptimization