Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  batch script to execute multiple test instances

    Posted 09/14/13 09:04 AM

    Originally posted by: adsi


    hey guys, 

    given the scenario of having one central model and 126 large test instances as .dat files, i would like to possibly create a batch script in order to automatically let cplex solve the instances, and store the results, preferrably only the objective value, along with the computation time. 

    unfortunately, i have no experience with creating batch files/models, so my question is whether, first, it is possible to implement such an approach, especially as the files are as aforementioned of data type .dat, and, secondly, whether someone could provide me with general code syntax in order to do so, or just give any sort of hint, how to deal with that problem.

    thank you very much already in advance!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: batch script to execute multiple test instances

    Posted 09/16/13 10:30 AM

    Hi,

     

    you should have a look at the example

    examples_suite.mod in opl\examples\opl\examples_suite

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: batch script to execute multiple test instances

    Posted 09/16/13 07:10 PM

    Originally posted by: adsi


    thanks alex. 

    1. i checked it, but couldn't i also do it with a simple oplrun command and a loop to let the machine execute the model with all the respective instances? or as in the example in the post above mine in this forum by user "pnuzyf"? 

    as im quite new to opl, i didnt fully grasp how to use your example for mine. 

     

    2. also, i have another question that you might be able to help me with. assuming i have a several models, in which after all, only few constraints differ, would it be possible to have make one model out of it, and pretty much switch constraints on/off when needed by adding a specific parameter e.g. 0/1?

    or how could i implement such a switch in opl?

     

    thank you again for your advice!

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: batch script to execute multiple test instances

    Posted 09/17/13 05:10 AM

    Hi

     

    For your second question, you could use UB, LB and setCoef.

     

    Let me give you an example:

     

    dvar float+ Gas;
    dvar float+ Chloride;   


    maximize
      40 * Gas + 50 * Chloride;
    subject to {
      ctMaxTotal:     
        Gas + Chloride <= 50;
      ctMaxTotal2:    
        3 * Gas + 4 * Chloride <= 180;
      ctMaxChloride:  
        Chloride <= 40;
       ctEmpty:
         Gas<=infinity;
    }
     
     main
     {
       thisOplModel.generate();
       cplex.solve();
       writeln(thisOplModel.Gas," ",thisOplModel.Chloride);
       thisOplModel.ctEmpty.UB=5;
       thisOplModel.ctEmpty.setCoef(thisOplModel.Gas,-1);
       thisOplModel.ctEmpty.setCoef(thisOplModel.Chloride,1);
       cplex.solve();
       writeln(thisOplModel.Gas," ",thisOplModel.Chloride);
       
     }
     

     

    Regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: batch script to execute multiple test instances

    Posted 06/19/15 05:10 PM

    Originally posted by: Jaff4r


    What about the first question?

     

    I have the same problem... I have a set of 400 instances to test with a couple of models. Could you please help me?

     

    Best regards

    Y


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: batch script to execute multiple test instances



  • 7.  Re: batch script to execute multiple test instances