Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Timelimit for Subproblems

  • 1.  Timelimit for Subproblems

    Posted Sun October 21, 2018 07:58 AM

    Originally posted by: PhilHz


    Hi all,

     

    i am currently implementing a heuristic that helps me to generate a production plan for multiple products k and multiple periods t. As the complexity of the problem is rather high, i separate the problem in several subproblems. 

     

    Specifically, one possibility is to subdivide the total problem in k subproblems. In the first subproblem I generate an optimal production plan for the first product and fixate the results. In the next subproblem I generate the production plan for the 2nd product, given the results of the first subproblem (c.p.). That way the complexity can be reduced dramatically, even though the quality of the solution might not be that good. 

     

    Now, I would like to set a time limit for the solution time of the total problem to 1800 seconds. My first Idea was to calculate an equal time limit for every subproblem that sums up to 1800 seconds. As some instances can be solved in less time than others, that approach is not satisficing. For Example: the solution timfor the first subproblem usually takes just a few seconds, but the required time rises with every product that i add. With an equal time limit for every subproblem, the total solution time would be < 1800 seconds. 

     

    What I want to to now is to calculate an equal time limit for every subproblem that adds up to 1800 like I did before. In the second step I would like to calculate the remaining time after solving a subproblem and calculate a new time limit for the remaining subproblems.

     

    Has anyone of you ever had to do with a similar problem and could help me with that problem, or is there maybe a much easier solution?

     

    Thanks in advance and best regards,

    Phil

     

    var K = thisOplModel.K;
    var T = thisOplModel.T
    var TimeLimitSec = thisOplModel.TimeLimitSec ;
    var Timelimit = TimeLimitSec / K;
    var mod, k,t, bestObjValue;
    cplex.tilim = Timelimit; 
    var before = new Date();
    var temp = before.getTime();

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Timelimit for Subproblems

    Posted Sun October 21, 2018 11:17 AM

    Hi,

    why don t you divide the time that is left before reaching the 1800 s limit over next m problems to solve ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Timelimit for Subproblems

    Posted Sun October 21, 2018 11:36 AM

    Originally posted by: PhilHz


    Hi Alex,

     

    Thanks for your reply. I try to give you an example of the problem.

     

    Current Solution:

    Time Limit for the whole Problem: 1800 Seconds

    # Products: 6  --> 6 subproblems to be solved

    Time Limit for each Subproblem: 1800 / 6 = 300 Seconds

     

     

    Now imagine the actual time needed to solve Subproblem 1 is only 100 sec, while the other subproblems are solved after 300 seconds. The solution time for all subproblems would be 1600 seconds. 

     

    But I need a solution that utilizes the whole 1800 seconds that are available. In my opinion I need recalculate the time limit for each subproblem.

     

    In the given Example: 

    Time needed for Subproblem 1: 100

    Time available for other Subproblems: 1800 - 100 = 1700 --> Time available for each remaining Subproblem: 1700 / 5 = 340 Seconds (and so on...)

     

    I have no idea if this is even possible..

     

    best regards

     

     

     

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Timelimit for Subproblems

    Posted Sun October 21, 2018 12:08 PM

    of course you can do that.

    You compute that time limit and set that time limit just before calling solve

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Timelimit for Subproblems

    Posted Sun October 21, 2018 02:16 PM

    Originally posted by: PhilHz


    Thanks, that actually helped.

     

    I had a hard time to find out how to redefine the remaining time.

     

    My solution:

     

    var RemainingTime= thisOplModel.TimeLimitSec ;
    var soltime = 0;

     

    soltime = soltime + cplex.getSolvedTime();
    cplex.tilim = (RemainingTime- soltime) / (K - k + 1)

    Solve()

     

     

    If you have any recommendations let me know.

     

    Best regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer