Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Iteratively find one more solution

    Posted Wed October 24, 2012 02:45 PM

    Originally posted by: RafaelMartinelli


    Hello,

    I am solving a problem by iteratively running a MIP. On each iteration, I add a set of temporary constraints and solve the MIP up to the next integral solution. At the end of the iteration, I remove the temporary constraints and then repeat.

    My problem is when I use the parameter IloCplex::IntSolLim. Sometimes, CPLEX finds more than 1 MIP start, so I cannot set IloCplex::IntSolLim to 2 or else CPLEX will return the solution from the last iteration. How should I configure CPLEX to make sure I have the next integral solution?

    Thank you,
    Rafael
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Iteratively find one more solution

    Posted Thu October 25, 2012 03:58 PM

    Originally posted by: SystemAdmin


    I see two choices here, in both you would keep the solution limit set to 1:

    1. After the CPLEX solve returns, you explicitly check whether the returned solution is new or whether it is one of your old solutions (you could use a hash table to do this). If it is an old one, just call cplex.solve() again to find a new solution.

    2. You just set the Advanced Start indicator to 0, which means to disregard all MIP starts. Of course, it could then still be that by coincidence you will get a solution that you already know.
    But is it actually correct that an old solution is still feasible for the new problem? If this is not the case (i.e., the additional constraints should rule out all of the previous solutions), then there is something wrong. Either your additional constraints are not correct, or there are numerical issues, or there is a bug somewhere else.
    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Iteratively find one more solution

    Posted Thu October 25, 2012 05:33 PM

    Originally posted by: RafaelMartinelli


    Tobias,

    The constraints that I add on each iteration are for sure feasible for the best solution so far. But I cannot say the same thing for the other integer constraints that cplex has. They may be feasible or infeasible. Usually I set IntSolLim to 2 in order to find one more feasible solution, but when cplex evaluates its old solutions and find more than one solution as a MIPStart, it just returns to me the same solution. This can cause my code to loop.

    There's also one strange behavior. For example, if in a given iteration cplex finds 2 feasible solutions from the old ones and I call cplex.solve() again, sometimes it finds 2 feasible solutions again (which makes sense), but sometimes it find just 1 feasible solution. I still cannot tell when cplex does one or the other. Do you know if cplex discard any MIPStart for some reason?

    Thank you,
    Rafael Martinelli
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Iteratively find one more solution

    Posted Thu October 25, 2012 05:50 PM

    Originally posted by: SystemAdmin


    Usually, the solutions found by CPLEX should have different objective values (because CPLEX would discard solutions that are equal to the current incumbent in terms of objective value). For numerical reasons, though, it can happen sometimes that CPLEX produces two solutions of almost identical objective value.

    This said, if for your models the solutions that CPLEX collects are always of different objective value, then you can just install an objective limit (via parameter setting) that is set to the value of the optimal solution of the previous iteration. This will make sure that only the optimal solution from the previous iteration is kept and the other ones will not be accepted.

    Note that setting the objective limit parameter to the same value as the solution that you want to keep will only work consistently with some more recent CPLEX version (something like 12.3, I think). Earlier versions were a bit fuzzy about the numerics for the objective limit when there exists a solution that has (almost) exactly this objective value.

    Another approach would be to just delete all but the incumbent MIP start.
    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Iteratively find one more solution

    Posted Thu October 25, 2012 06:20 PM

    Originally posted by: RafaelMartinelli


    Tobias,

    Thanks for your answer. I am using cplex 12.4, so there will be no problem using this approach. I will try this tomorrow.

    You mentioned about deleting all but the incumbent MIP start. I have thought about this before, but I couldn't find how to do this (since there is no more the .chm help, my life got a little bit more complicated). Could you tell me?

    Thank you again,
    Rafael Martinelli

    PS.: Please, please ask people there to come back with the .chm help! :)
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Iteratively find one more solution

    Posted Mon October 29, 2012 04:42 AM

    Originally posted by: SystemAdmin


    To delete MIP starts, you can use the cplex.deleteMIPStarts() method.
    The incumbent should be at position 0, so you can call cplex.deleteMIPStarts(1, cplex.getNMIPStarts()-1).

    Tobias
    #CPLEXOptimizers
    #DecisionOptimization