Originally posted by: apscomeup
Hi! I need to solve optimization tasks in cycle. So have some questions.
1. Is it possible to change objective function and use only one .mod file?
Possible to define objective in cycle or to define them in .mod file using 'dexpr' type and run needed objective or there exists some other ways.
2. Another matter, is it possible to define (or redefine) parameters values which are used in the .mod file. When i try to do it you can see the comment '//opl.pTest = 3;' I have an error that it is not allowed to define via flow control.
3. The last, is it possible to write results from flow control to Access database or the unique way is using 'opl.postProcess();' and define commands to write data in .dat file as i've done in code below
main
{
for (var s = 1; s <= 2; s++)
{ var source =
new IloOplModelSource(
"prtOptim.mod"); var cplex =
new IloCplex(); var def =
new IloOplModelDefinition(source); var opl =
new IloOplModel(def,cplex); var data =
new IloOplDataSource(
"prtOptim.dat"); opl.addDataSource(data); opl.generate();
//opl.pTest = 3;
//opl.ACTIVESCENES = {1,2,3,4,5}; opl.ACTIVESCENES.add(s); var res = cplex.solve(); writeln(
"Yeeeh babyMM!"); writeln(res); writeln(opl.ACTIVESCENES);
//writeln(cplex.getObjValue()); opl.postProcess();
};
};
#DecisionOptimization#OPLusingCPLEXOptimizer