Decision Optimization

 View Only
Expand all | Collapse all

Retrieving best solution after each hour (MATLAB)

  • 1.  Retrieving best solution after each hour (MATLAB)

    Posted Sat April 11, 2020 08:09 AM

    Originally posted by: AsToN


    Hi everyone,

     

    is there a way to retrieve the best integer solution found after given intervals of time (e.g. hours)? So I would like to know what was the best solution that CPLEX found after 1h, 2h, 3h and so on. I am using the MATLAB API of CPLEX 12.8.

     

    Thank you!


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Retrieving best solution after each hour (MATLAB)

    Posted Tue April 14, 2020 02:49 AM

    There are two options to do that:

    1. Use the info callback. In the callback check how much time expired and if 1, 2, ... hours expirted then fetch the current best soltuion. You have an example that does almost this in the cplexplot.m example that is shipped with CPLEX.
    2. Set the time limit to 1 hour and call solve(). After CPLEX returns, fetch the best solution. Then call solve() again. This will continue at the point at which CPLEX stopped before and will run for another our. Repeate this until the model is solved.

    I would prefer the 1st approach.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Retrieving best solution after each hour (MATLAB)

    Posted Fri April 24, 2020 11:48 AM

    Originally posted by: AsToN


    Thank you Daniel!

    A very helpful reply, as always I should say.

     


    #CPLEXOptimizers
    #DecisionOptimization