Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

setting a time limit for flow control

  • 1.  setting a time limit for flow control

    Posted 08/07/17 04:52 AM

    Originally posted by: felycite28


    Hello everybody ,

    ı 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?

    Can you help me please ?

    Regards

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: setting a time limit for flow control

    Posted 08/13/17 01:50 PM

    Hi

    what about

    opl.generate();

    cplex.tilim=100;

    if (cplex.solve())

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer