Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to use printSolution method?

    Posted 07/26/14 01:24 AM

    Originally posted by: TracyLLL


    Hi,

    I want to write the solution to my model to a .txt or excel file for post processing. I found this printSolution method and the expected output is a .dat file. But  I am not sure how it works. I tried in the main block:

    thisOplModel.generate();
    var ofile=new IloOplOutputFile("output.txt");
    var udcDef=thisOplModel.modelDefinition;
    var udcCplex=cplex;
    var udcDat=thisOplModel.dataElements;
    var udc=new IloOplModel(udcDef,udcCplex);
    udc.addDataSource(udcDat);
    udc.generate();
    if(udcCplex.solve()){
        udc.printSolution();
        ofile.writeln("solution found");
    }else{
        ofile.writeln("no solution");
    }

    After running the model, no error or warning msg was shown. The output file showed "solution found", but I could not find a .dat file in my model directory for the solution file. Is it saved in a different path? Where? Or do I need to set a name for the solution  .dat file? Can anyone give an example?

    Thanks a lot!

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: How to use printSolution method?

    Posted 07/28/14 04:01 AM

    Hi,to check that what you do is working you could use an absolute path like

    var ofile=new IloOplOutputFile("c:/output.txt");

    instead of

    var ofile=new IloOplOutputFile("output.txt");

    The doc of Class IloOplOutputFile states

    The script creates the file output.txt in the directory where the .mod file is located.

     

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer