Originally posted by: naveendivakaran
Hi,
I am trying to run a 2nd solve on a model that is basically a modified version of the original model, in which I have to modify the coefficients of an array of variables in a constraint. I am trying to do that without having to run the generate function. The way I tried to do this is:
for(var i in opl.setWW)
{
opl.ctBacklog[i].UB = 1000;
iconst = Math.ceil((opl.ObjWeeklyBacklog[i])*1/scale_factor);
opl.ctScaled_Backlog[i].setCoef(opl.Scaled_ObjBacklog[i],-iconst);
}
where ctBacklog and ctScaled_Backlog are constraints on array of variables. I get a "No Solutions Error" when it is trying to run this for loop. What am I doing wrong? The approach that I am taking to meet my goal for now is to create a fresh opl object after the first solve, and modify coefficients there which works fine. But I have to generate the model which consumes 3 minutes, that I would like to avoid. Please let me know if there is a way without having to run the generate method.
Method that works: (which requires regeneration 3 extra minutes)
vardef2 = opl.modelDefinition;
var data2 = opl.dataElements;
var cplex2 = new IloCplex();
var opl2 = new IloOplModel(def2,cplex2);
opl2.addDataSource(data2);
for(var i6 in opl.setWW)
{
opl2.ctBacklog[i6].UB = scale_factor+ub_tolerance;
iconst = Math.ceil((opl.ObjWeeklyBacklog[i6])*1/scale_factor);
opl2.ctScaled_Backlog[i6].setCoef(opl2.Scaled_ObjBacklog[i6],-iconst);
}
Please help me with this task.
-Naveen
#DecisionOptimization#OPLusingCPLEXOptimizer