Originally posted by: Redhat11
Hi,
I am trying to change the objective function on several runs of solving the model
I have this in my mainfunction but it does not modify the variable "testweight" in the objective function.
var model = thisOplModel;
var data = new IloOplDataSource("data.dat");
//model.generate();
var elements = model.dataElements;
writeln(elements.testweight);
elements.testweight = 5000;
writeln(elements.testweight);
model.addDataSource(elements);
model.generate();
this is how the objective function looks like
minimize
sum(d in day, p in product, s in source) (c[d][s] * x[d][s][p]) + testweight * sum (d in day, s in source) (y[d][s]);
When printing out the variable in logs it shows that the variables value has changed, however, when solving the model it still uses the old value. Anyone knows how to solve my problem?
#CPLEXOptimizers#DecisionOptimization