Originally posted by: nr-mz
Dear All,
I would like to write you to ask for a help please.
Actually, in my problem I need to solve a set of constraints for different objective functions. Indeed, I have a set of activities i, and for each of the activities I have a decision variable named S[ i ]. Also a set of constraints is defined. Now, for each activity i, I should minimize S[ i ] subject to the constarint.
For that purpose, I have defined the constaints and added them to my IloCplex object, which is named cplex. Then I have defined the objective function and added it as well to cplex. In order to iterate over i, I create a For loop and then I do like following:
for(int i=0; i<I;i++){
IloLinearNumExpr obj = modeler.linearNumExpr();
modeler.addMinimize(obj);
obj.addTerm(1, S_StartDateOfActvity[i]);
cplex.solve();
if (modeler.solve()){
System.out.println("Solved "+modeler.getObjValue());
}
else{"opl
System.out.println(" NOT SOLVED");
}
}
But by this way I cannot iterate over i. Cplex solves just for first i and I it sends the error message saying " opl cannot handle multiple objectives"
I added these commands " modeler.end();" and "modeler.remove( (IloAddable) obj);" but still I cannot overcome the error message.
Actually, I wonder what I should do if I want to iterate the objective function over i and in each iteration solve the objictive function with my constraints. Could you please help me?
I thank you so much for your attention.
#CPLEXOptimizers#DecisionOptimization