YALMIP simple explanation of the algorithm area

Source: Internet
Author: User


Recently, when doing a thesis, it involves the optimization problem, and most of the optimization involves two constraints two times planning qcqp such a convex problem, generally, such a convex problem is not the global accurate optimal solution, need to find a new way. The commonly used is a partially relaxed SDR. The nonlinear relaxation is linear, so that it can be SDP, using the proprietary convex programming toolbox such as CVX to solve; but the disadvantage is also obvious: flexibility and reliability is not high, when the constraints there is also a positive definition of the unknown matrix, the SDR powerless, when the introduction of the QCQP under the second-order cone specification SOCP, The approximate solution of such optimization problem can be solved well by using YALMIP. So it is necessary to say the simple application of YALMIP:



YALMIP has a total of four processes:



1: Set Variable;



2:: Set the objective function f;



3: Set the qualification conditions;



4: Use the Toolbox to ask.



1: Set the variable



Variable settings commonly used in three kinds: Sdqvar () Set the real type, Intvar () Set the shape, Binvar () set the binary. Take Sdqvar () for example. The most important instruction in YALMIP is Sdpvar. This instruction is used to define the decision variables. Define a matrix (or scalar) P with n rows and m columns, and we write:



P=sdqvar (N,M), which is a default symmetric real matrix, resembles a simple form Sdqvar (n) and a detailed form Sdqvar (n,m, ' symmetric ');



The third parameter can be used to obtain a number of predefined types of variables, such as Toeplitz, Hankel, diagonal (diagonal), symmetric (symmetric), and skew-symmetric (against-call) matrices, for information see Sdpvar Help documentation;



Of course, in order to obtain a fully parameterized (not necessarily symmetric) phalanx, the third parameter is necessary: P = Sdpvar (n,n, ' full ');



A fully parameterized (not necessarily symmetric) matrix of a plural form: P = Sdpvar (n,n, ' full ', ' complex ');



At the same time, you can also make up the third and fourth parameters: P = Sdpvar (n,n, ' sy ', ' Co ')



2:sdpsettings



Sdpsettings is a bridge between YALMIP and solver, and is generally used as the third entry parameter for optimization functions optimize, Solvesos, solvemoment, and solvemp (this article is SOLVESDP):



options = sdpsettings (' field ', Value, ' field ', Value,...)
Optimize (Constraints, objective, options)



For example: Ops = sdpsettings (' Solver ', ' SDPA ', ' sdpa.maxiteration ', 100);



You can see the default parameters for all of its selections from the OPS = sdpsettings directive:





ops = sdpsettings;

ops
               solver: ''
              verbose: 1
              warning: 1
         cachesolvers: 0
                debug: 1
        beeponproblem: [-5 -4 -3 -2 -1]
         showprogress: 0
            saveduals: 1
     removeequalities: 0
     savesolveroutput: 0
      savesolverinput: 0
    convertconvexquad: 1
               radius: Inf
                relax: 0
                usex0: 0             
            savedebug: 0
                  sos: [1x1 struct]
               moment: [1x1 struct]
                  bnb: [1x1 struct]
                bpmpd: [1x1 struct]
               bmibnb: [1x1 struct]
               cutsdp: [1x1 struct]
               global: [1x1 struct]
                  cdd: [1x1 struct]
                  clp: [1x1 struct]
                cplex: [1x1 struct]
                 csdp: [1x1 struct]
                 dsdp: [1x1 struct]
                 glpk: [1x1 struct]
                 kypd: [1x1 struct]
               lmilab: [1x1 struct]
              lmirank: [1x1 struct]
              lpsolve: [1x1 struct]
               maxdet: [1x1 struct]
                  nag: [1x1 struct]
               penbmi: [1x1 struct]
               pennlp: [1x1 struct]
               pensdp: [1x1 struct]
                 sdpa: [1x1 struct]
                sdplr: [1x1 struct]
                sdpt3: [1x1 struct]
               sedumi: [1x1 struct]
                qsopt: [1x1 struct]
               xpress: [1x1 struct]
             quadprog: [1x1 struct]
              linprog: [1x1 struct]
             bintprog: [1x1 struct]
              fmincon: [1x1 struct]
           fminsearch: [1x1 struct]


There are Semudi options in Ops, and then Ops.semudi to view Semudi toolbox parameters such as semudi.sps=1e-12:







Ops.sedumi

ans = 

          alg:2
         beta:0.5000
        theta:0.2500
         free:1 sdp:0 stepdif:0
            w: [1 1]< C8/>mu:1
          eps:1.0000e-09
       bigeps:1.0000e-03
      maxiter:150
        vplot:0 stopat
       :-1
         Denq: 0.7500
         denf:10
       numtol:5.0000e-07
    bignumtol:0.9000
      numlvlv:0 chol
         : [1x1 struct]
           CG: [1x1 struct]
    Maxradius:inf

3:optimize (the optimization function of this paper takes SOLVESDP as an example)





Optimize is a common function to solve the optimization problem, in this paper SOLVESDP is one of them. Format: Diagnostics = Optimize (Constraints,objective,options)



To give a simple example: we face a linear programming lp:{min cTx subject to ax<= B}, using this method:





x = Sdpvar (Length (c), 1);
F = [a*x<=b];
h = C ' *x;
Optimize (f,h);
Solution = value (x);
If we only consider flexibility then we can ignore the objective function H, get: Diagnostics = Optimize (F); The returned diag can be used in the test flexibility:







If Diagnostics.problem = = 0
 disp (' feasible ')
elseif Diagnostics.problem = = 1
 disp (' infeasible ')
else
 disp (' Something else happened ')
end

4:double





After the above function obtains the optimization result, needs to display, then needs value (X), double is one kind, namely extracts the numerical value from the decision vector.



The overall effect can be illustrated in one more example:





Known nonlinear integer programming is:
Max z=x1^2+x2^2+3*x3^2+4*x4^2+2*x5^2-8*x1-2*x2-3*x3-x4-2*x5
s.t.
0<=xi<=99 (i=1,2,..., 5)
x1+x2+x3+x4+x5<=400
x1+2*x2+2*x3+x4+6*x5<=800
2*x1+x2+6*x3<=
x3+x4+5*x5<=200
input X=intvar (1,5) in Matlab,
f=[1 1 3 4 2]* (x '. ^2)-[8 2 3 1 2]*x '; F=set (0<=x<=99);
F=f+set ([1 1 1 1 1]*x ' <=400) +set ([1 2 2 1 6]*x ' <=800) +set (2*x (1) +x (2) +6*x (3) <=800);
F=f+set (x (3) +x (4) +5*x (5) <=200) SOLVESDP (f,-f)
double (F)    80199
double (x)    99     0
Intvar (m,n): Generate an integer variable;
sdpvar (m,n): production variable;
SOLVESDP (f,f): To solve the optimal solution (minimum value), Where f is the constraint (with set connection), F is the objective function
double: Displays the answer to the solution




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.