Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Can I use script to enable Postprocess feasible solutions?

  • 1.  Can I use script to enable Postprocess feasible solutions?

    Posted Thu January 30, 2014 02:41 AM

    Originally posted by: qtbgo


    Hi, I use an independent main file to solve a MIP model, I want to get the objectives of each intermidate feasible solutuon using script.

    1 I know we can enable  Postprocess feasible solutions using an OPS setting file, then in the postprocess block, we can  get the objectives. What I am wondering is can I enable Postprocess feasible solutions using script and how?

     

    2 Is it possible to get these objectives in a main block without using postprocess block?

     

    thanks in advance

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Can I use script to enable Postprocess feasible solutions?

    Posted Thu January 30, 2014 02:56 AM

    Hi,

    1) Have you tried thisOplModel.settings.run_processFeasible=true; ?

    2) You can do that by either using the solution pools or call the solve with a timelimit, get the solution and call the solve again

    Regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Can I use script to enable Postprocess feasible solutions?

    Posted Fri January 31, 2014 08:24 PM

    Originally posted by: qtbgo


    Thank you Alex. I consult the mannual for solution pools, and now I can use getObjValue(i)  to obtain intermidate results, but how to obtain the solving times of these results?  


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Can I use script to enable Postprocess feasible solutions?

    Posted Sat February 01, 2014 11:27 AM

    Why not using var d=new Date();

    and then use - to compute times ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Can I use script to enable Postprocess feasible solutions?

    Posted Mon February 03, 2014 08:39 AM

    Originally posted by: qtbgo


    Dear Alex, I can use "var d=new Date();" method to get solve time for each intermediate solutions in the post process block. But I have a large number of instances to solve, so I do not use post process block, instead, I use an independent main file to solve them one bye one.

    Now , in the main file, I can use the following code to get intermediate objectives, but, cannot get solve time for e.g. MIP obj 1 , because the solving process have ended. Could you give any idea?

        if ( subCplex.solve() ) 

          {
              writeln("MIP best obj ",subCplex.getObjValue(),  " solveTime ", (new Date()-before)/1000, " iter ", subCplex.getNiterations() );
          }
        writeln("MIP obj 0 ",subCplex.getObjValue(0) );
        writeln("MIP obj 1 ",subCplex.getObjValue(1) );
        
     

    #DecisionOptimization
    #OPLusingCPLEXOptimizer