Decision Optimization

Decision Optimization

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


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

How to store the last integer solution in OPL

  • 1.  How to store the last integer solution in OPL

    Posted 03/19/19 04:18 PM

    Originally posted by: 88Simon88


    Hello everybody,

    I am running a model which takes hours to find the optimal solution. Now I have two questions:

    1- How can I impose a gap limit or time limit for termination of the algorithm? For example, I want to know the best integer solution within 1 hour? or stop solving the problem if the gap is less than 1%?

    2- How can I store or print the best integer solution within the termination limit? 

    I deeply appreciate you if you could explain them to me with an example code.

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: How to store the last integer solution in OPL

    Posted 03/20/19 04:24 AM

    Hi

    1)

    You could try

    execute
    {
    cplex.tilim=3600;
    cplex.epgap=0.01;
    }

    2)

    You can do that through writeln in postprocess

    See https://www.linkedin.com/pulse/making-decision-optimization-simple-alex-fleischer/

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: How to store the last integer solution in OPL

    Posted 03/20/19 11:39 AM

    Originally posted by: 88Simon88


    Thanks for your reply.

    For the second question, I have two choices:

    1) write code in post process, like:

     execute DISPLAY_OBJ
    {
        writeln("Optimal objective value="+cplex.getObjValue())
    }

     

    2) write code in scripting log, like 

    write(X)
    write(cplex.getObjValue())
    var ofile = new IloOplOutputFile("modelRun.txt");
    ofile.writeln("Optimal objective value="+cplex.getObjValue())
    ofile.writeln(X)
    ofile.close();

     

    put me right if I am wrong? 

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer