'time setting for flow control

ı have small question . I want to set time limit for my flow control script but I could not know where to insert it . Here is my code:

main
{
    var source=newIloOplModelSource("xxx.mod");
    var def=newOplModelDefinition (source);
    var j;
    for (j=1;j<=5;j++)
    {
        var name="instance.dat";
        var data=new IloOplDataSource(name);
        var opl=newIloOplModel(def,cplex);
        opl.addDataSource(data);
        opl:generate();
        if (cplex:solve()){
        //do that
        }
    }
}

I want to set time limit for each iteration of for loop. Let's say the limit is 1 hour after one hour the model should start to solve second file ( j=2 ) after one hour third file (j=3) etc .

I have seen some examples from the previous posts , I tried them but somehow it did not work in a correct way , so I could not know where and how to insert time limit into the code?



Solution 1:[1]

Similar question at:

https://www.ibm.com/developerworks/community/forums/html/topic?id=6b77ef16-de77-403f-8d12-5efe5320f3e9&ps=25

opl.generate();

cplex.tilim=100;

if (cplex.solve())

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 halfer