Basic flow control script

Presents two templates to help you write flow control scripts.

To help you write flow control scripts, here are two templates you can start from.

Flow control script template calling a project calls a project file while Flow control script template calling a model and data calls model and data files.

Flow control script template calling a project

main { 

var proj = new IloOplProject("../../../../../opl/mulprod");

var rc=proj.makeRunConfiguration();

rc.oplModel.generate();

if (rc.cplex.solve()) {

writeln("OBJ = " + rc.cplex.getObjValue());

}

else {

writeln("No solution");

}

rc.end();

proj.end(); 

}

Flow control script template calling a model and data

main { 

var source = new IloOplModelSource("../../../../../opl/mulprod/mulprod.mod");

var cplex = new IloCplex();

var def = new IloOplModelDefinition(source);

var opl = new IloOplModel(def,cplex);

var data = new IloOplDataSource("../../../../../opl/mulprod/mulprod.dat");

opl.addDataSource(data);

opl.generate();

if (cplex.solve()) {

writeln("OBJ = " + cplex.getObjValue());

}

else {

writeln("No solution");

}

opl.end();

data.end(); 

def.end(); 

cplex.end(); 

source.end(); 

}