how can I get all optimal solutions using Yalmip linked with CPLEX

380 views
Skip to first unread message

yezhifneg

unread,
Oct 15, 2013, 4:33:49 AM10/15/13
to yal...@googlegroups.com
I was using yalmip toolbox linked with CPLEX to solve optimization problem.
a example can be shown like 

MIQP Presolve eliminated 121 rows and 0 columns.
Aggregator did 24 substitutions.
Reduced MIQP has 728 rows, 936 columns, and 3768 nonzeros.
Reduced MIQP has 936 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.01 sec. (3.03 ticks)
Probing fixed 24 vars, tightened 0 bounds.
Probing time = 0.02 sec. (2.28 ticks)
Clique table members: 4432.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 2 threads.
Root relaxation solution time = 0.06 sec. (24.60 ticks)

        Nodes                                         Cuts/
   Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

      0     0       -9.2000   269                     -9.2000      725         
      0     0       -9.2000   139                     Cuts: 4      786         
      0     0       -9.2000   203                    Cuts: 41      967         
      0     0       -9.2000    94                 ZeroHalf: 1      970         
      0     0       -9.2000   200                ZeroHalf: 20     1129         
*     0+    0                           -7.8500       -9.2000     1129   17.20%
*     0+    0                           -8.4500       -9.2000     1129    8.88%
*     0+    0                           -8.8500       -9.2000     1129    3.95%
      0     2       -9.2000   130       -8.8500       -9.2000     1129    3.95%
Elapsed time = 0.86 sec. (279.74 ticks, tree = 0.01 MB, solutions = 3)
*    79+   75                           -9.0000       -9.2000     9841    2.22%
*    85    77      integral     0       -9.1000       -9.2000    10188    1.10%
*   116    79      integral     0       -9.1000       -9.2000    10965    1.10%
*   153    48      integral     0       -9.2000       -9.2000    12312    0.00%
Implied bound cuts applied:  2
Zero-half cuts applied:  10

Root node processing (before b&c):
  Real time             =    0.83 sec. (276.23 ticks)
Parallel b&c, 2 threads:
  Real time             =    0.65 sec. (261.08 ticks)
  Sync time (average)   =    0.00 sec.
  Wait time (average)   =    0.00 sec.
                          ------------
Total (root+branch&cut) =    1.48 sec. (537.31 ticks)

 Suppose in my codes, the decision variable is X, then I can use ' double(X)' get final solution 
 my question is how can I know how much optimal solutions I got at last, and how can matlab display all optimal solutions, Because it always only give 1 solution. What codes should I use?
 And in command window, CPLEX shows solution=3, is this means at that time, they find 3 solutions have the same objective value? 

Johan Löfberg

unread,
Oct 15, 2013, 5:52:59 AM10/15/13
to yal...@googlegroups.com
Solution pools currently not supported. Under development though, but there were some strange crashes in cplex so it is not released.

If x is binary, you can resolve the problem, and add a cut to avoid the known solution. For instance

allX = [];
sol = solvesdp(con,obj)
while sol.problem == 0
allX = [allX double(x)];
con = [con, exclude(x,double(x)];
 sol = solvesdp(con,obj);
end



Johan Löfberg

unread,
Oct 15, 2013, 6:12:35 AM10/15/13
to yal...@googlegroups.com
Message has been deleted

yezhifneg

unread,
Oct 15, 2013, 9:53:37 AM10/15/13
to yal...@googlegroups.com
Thank you John, variable in my problem is binary. Your suggestion really saved my work!

yezhifneg

unread,
Oct 15, 2013, 8:51:24 PM10/15/13
to yal...@googlegroups.com
John, I followed your method and rewrite my code, 
However, when I run my codes, the result is:

Undefined function 'exclude' for input arguments of type 'ndsdpvar'.

Error in trainee_S111 (line 133)
    F=[F,exclude(X,double(X))];

is there anything missing?

Johan Löfberg

unread,
Oct 16, 2013, 1:52:27 AM10/16/13
to yal...@googlegroups.com
Use  F=[F,exclude(X(:),double(X(:)))]; instead and it will work
Reply all
Reply to author
Forward
0 new messages