Getting all optimal soultions from the solver

74 views
Skip to first unread message

Hope Miller

unread,
Jul 30, 2019, 9:48:35 AM7/30/19
to YALMIP
Dear all
An optimization problem may have mltiple optimal solutions. How could I get all the solutions or just the number of them from Yalmip?
for example 

11.png

Obviously,there are two optimal solutions to this problem, namely  -10 and 10. However,I can only get one of them now.

22.png

I wonder how could I get all of them or the number of the optimal solutions.


Thanks a lot in advance.

Johan Löfberg

unread,
Jul 30, 2019, 10:14:10 AM7/30/19
to YALMIP

Hope Miller

unread,
Jul 30, 2019, 10:34:08 PM7/30/19
to YALMIP
Thank you for your reply.
I tried it but failed. Actually there is no field 'result' in 'solveroutput'.  I am really confused about this. Is it because I chose 'CPLEX' as the solver?

22.png



11.png


33.png



Johan Löfberg

unread,
Jul 31, 2019, 1:26:12 AM7/31/19
to YALMIP
send code, not a picture of code

Johan Löfberg

unread,
Jul 31, 2019, 1:30:58 AM7/31/19
to YALMIP
Although here I think the problem is too trivial so the pool generator is never activated as cplex never goes into any branching process. To be guaranteed to get all solutions (which you don't using pools, they will just give you all optimal encountered encountered until the search tree is empty) you will have to solve the problem repeatedly excluding the last one using the command exclude (i.e. it is extremely expensive to enumerate all optimal solutions)

Also note that the problem you are testing is a nonconvex MIQP, so you have to tweak cplex with the optimalitytarget option to actually solve the nonconvex QP relaxations

Hope Miller

unread,
Jul 31, 2019, 8:22:40 AM7/31/19
to YALMIP
Thank you for your reply.
My final codes are listed in the attachment. I think the problem is complicated enough to activate the pool generator, but I still failed to find the  field 'result' in 'solveroutput'. 
Optimization_second_simple.m

Johan Löfberg

unread,
Jul 31, 2019, 9:47:49 AM7/31/19
to YALMIP
you are trying to set options for gurobi, in the cplex structures?

options.cplex.PoolSearchMode

Reference to non-existent field 'PoolSearchMode'.
 


cplex has something similar perhaps
>> options.cplex.mip.pool

ans = 

  struct with fields:

       absgap: 1.0000e+75
     capacity: 2.1000e+09
    intensity: 0
       relgap: 1.0000e+75
      replace: 0



and yalmip is screaming at you that you are missing bounds on variables involved in the big-M represented implies operators

Hope Miller

unread,
Jul 31, 2019, 10:28:17 AM7/31/19
to YALMIP
Sorry, I am still confused about how to set options for CPLEX to get all the optimal solutions to the priblem.

Johan Löfberg

unread,
Jul 31, 2019, 10:33:23 AM7/31/19
to YALMIP
you would have to read the documentation (if it even is possible)

Hope Miller

unread,
Jul 31, 2019, 11:19:58 PM7/31/19
to YALMIP
But I have no idea about how to call populate in Matlab.  Could you give me some help?


Johan Löfberg

unread,
Aug 1, 2019, 1:23:11 AM8/1/19
to YALMIP
You will have to tweak those options and see what you get in the extra outputs when you turn on savesolveroutput

Hope Miller

unread,
Aug 1, 2019, 9:55:58 PM8/1/19
to YALMIP
Thank you
Reply all
Reply to author
Forward
0 new messages