Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  errors with batch model

    Posted 09/14/13 11:14 AM

    Originally posted by: pnuzyf


    Hi, my friends! 

     I tried the following model and data files in OPL, but I got the following errors:

     

    Data parsing error: syntax error, unexpected '=', expecting (identifier) or from or (identifier path).
    Invalid escape sequence "\U".

     

    What is the reason? How can I solve these errors?

     

     

    //batch.model

    string mymodel = ...;
    {string} Files = ...;


     main
    {
      for (var dataName in thisOplModel.Files)
      {
         var source = new IloOplModelSource(thisOplModel.mymodel);
         var def = new IloOplModelDefinition(source);
         var algo = new IloCplex();
         var theModel = new IloOplModel(def,algo);
         var data = new IloOplDataSource(dataName);
         theModel.addDataSource(data);
         theModel.generate();

        if ( algo.solve() )
        {  
           writeln(algo.getObjValue());
           theModel.postProcess();
        }
        else
        {
           writeln("\tNo solution found!");
        }

        theModel.end();
        algo.end();
        def.end();
        source.end();
      }   
    }

    //batch.data

    string mymodel = "C:\Users\James\Desktop\test\test.mod"
    {string} Files={"C:\Users\James\Desktop\test\uniformtest1.dat"
                      "C:\Users\James\Desktop\test\uniformtest2.dat"}

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: errors with batch model

    Posted 09/14/13 08:26 PM

    Originally posted by: pnuzyf


    I have solve the above problem! This is due to I include string  in the data file!! But I still have three other issues:

    1. How to set the "relative mip gap torrence". Actually, we have one batch.ops for batch.model. And I set the value of "relative mip gap torrence" to 0.02! but it seems  that it does not work! While I run it for test.mod with a single data set, it works well? Anyone who can tell me how to solve?

    2. I want to run multiple data sets! A part of the solution obtained for the previous data set will be used for the next data set! In otherwords, I should output those data element to the next data set and update the next data set. I just use "  var output1 = new IloOplOutputFile("uniformtest2.dat");  output1.writln(the relative data element); It seems that it will create a new file which is named uniformtest2.dat, but it is different from the fild that I used for the next model.

    3. It is possible output the solution for each data set in different files? I want the names of different files special, such as include the name of the current data set?

     

    Thank you very much!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: errors with batch model

    Posted 09/16/13 11:04 AM

    Hi

     

    1) To set the gap, after the line

    var algo = new IloCplex();

    you should write algo.epgap=0.02;

    2) If you want uniformtest2.dat to be used as a dat file later, you should write everything in the file using the .dat format

    3) That is possible, yo usimply need to replace IloOplOutputFile("uniformtest2.dat"); by IloOplOutputFile(fileName); where fileName is a string variable.

     

    I hope this helps

     

    Regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer