I want to limit the whole run time to be 1800 s for the given configuration which consists of main problem through which sub-problems:1 & 2 are called. In addition to this, can you please tell me how to set the time limit differently for different sub models? For example if I want to limit the run time of Sub-Problem 1 to 500 s and Sub-Problem 2 to 800 s. I used the line- execute{ cplex.tilim=1800;} as shown in the code description but the program runs for more than 1800 s.
//-----------------Main-problem.mod-------------------------------
//variables definition here
execute {cplex.tilim= 1800;}
Objective function;
subject to {
Constraints:1-7
}
execute FillDuals {
Dual of constraint 1;
}
}
main{
thisOplModel.settings.mainEndEnabled = true;
thisOplModel.generate();
var masterDef = thisOplModel.modelDefinition;
var masterCplex = cplex;
var masterData = thisOplModel.dataElements;
var masterOpl = new IloOplModel(masterDef,masterCplex);
masterOpl.addDataSource(masterData);
masterOpl.generate();
masterCplex.solve();
masterOpl.postProcess();
//\**************Calling Sub-Problem 1*********************************
var SubSource1 = new IloOplModelSource("Sub-Problem1.mod");
var Sub1Def = new IloOplModelDefinition(SubSource1);
var Sub1Def = thisOplModel.modelDefinition;
var Sub1Cplex = cplex;
var Sub1Data = thisOplModel.dataElements;
var Sub1Opl = new IloOplModel(Sub1Def,Sub1Cplex);
Sub1Opl.addDataSource(Sub1Data);
Sub1Opl.generate();
Sub1Cplex.solve();
//\****************************************************************
//\*******************Calling Sub-Problem2*********************************
var SubSource2 = new IloOplModelSource("Sub-Problem2.mod");
var Sub2Def = new IloOplModelDefinition(SubSource2);
var Sub2Def = thisOplModel.modelDefinition;
var Sub2Cplex = cplex;
var Sub2Data = thisOplModel.dataElements;
var Sub2Opl = new IloOplModel(Sub2Def,Sub2Cplex);
Sub1Opl.addDataSource(Sub2Data);
Sub2Opl.generate();
Sub2Cplex.solve();
//\****************************************************************
} //end of main
//--------------------Sub-Problem1.mod------------------------
variables and constants definition;
Objective function;
subject to {
Constraints:
}
//SubOpl1 doesnt have main function main{}
//-------------------Sub-Problem2.mod----------------------
variables and constants definitions;
Objective function;
subject to {
Constraints:
}
//SubOpl2 doesnt have main function main{}
//-------------------------------------------------------