Decision Optimization

 View Only
  • 1.  get all optimal solutions

    Posted Fri July 03, 2020 10:43 AM
    Hi,

    I can see in solve details that I sometimes get a few number of solutions, and I want to know if it is possible to collect all the optimal solutions.

    Any idea?
    best,
    #DecisionOptimization


  • 2.  RE: get all optimal solutions

    Posted Fri July 03, 2020 10:46 AM
    Yes, this is possible. See this section in the user manual.

    ------------------------------
    Daniel Junglas
    ------------------------------



  • 3.  RE: get all optimal solutions

    Posted Fri July 03, 2020 10:48 AM
    Sorry I did not indicate that I am using docplex. Is there an equivalent in docplex?


  • 4.  RE: get all optimal solutions

    Posted Fri July 03, 2020 11:46 AM
    Hi,
    solutions pools are available in docplex too

    See

    solution pools

    in

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

    regards

    ------------------------------
    ALEX FLEISCHER
    ------------------------------



  • 5.  RE: get all optimal solutions

    Posted Fri July 03, 2020 11:49 AM
    Thanks a lot!
    best,


  • 6.  RE: get all optimal solutions

    Posted Mon July 06, 2020 03:36 AM
    Hi Alex,

    the code that you suggested, it is possible to get all the feasible solutions, right? because the objective function that I get without using cpx.populate_solution_pool() is not the same as the mean  objective value of the solution pool (also the number of solutions is 2 without the solution pool and is equal to 23 with the solution pool).
    Do you know how to modify this to get only the "optimal" solutions? 
    best,


  • 7.  RE: get all optimal solutions

    Posted Mon July 06, 2020 06:30 AM
    Hi,

    I updated my github example so that the settings are taken into account

    regards

    ------------------------------
    ALEX FLEISCHER
    ------------------------------



  • 8.  RE: get all optimal solutions

    Posted Mon July 06, 2020 07:41 AM
    Hi Alex,

    Thanks for your help. I think one line is missing in your code though:
    mdl.parameters.mip.pool.absgap = 0
    Otherwise, the mean of the objective value of the solution pool in my case is higher than that of the optimal solution.

    However, is it possible to only the solution value of only the nonzeros binary variables, or at least display the nonzeros solutions values?

    Thanks in advance,
    best,


  • 9.  RE: get all optimal solutions

    Posted Mon July 06, 2020 08:12 AM
    Hi

    yes indeeed. To get all optimal solutions : https://github.com/AlexFleischerParis/zoodocplex/blob/master/zooenumerateall.py

    which gives

    The solution pool contains 3 solutions.
    The average objective value of the solutions is 3000.
    this is solution #1 of the pool
    solution for: buses
    nbBus40 = 6
    nbBus30 = 2
    this is solution #2 of the pool
    solution for: buses
    nbBus30 = 10
    this is solution #3 of the pool
    solution for: buses
    nbBus40 = 3
    nbBus30 = 6

    regards

    ------------------------------
    ALEX FLEISCHER
    ------------------------------