資源簡介
matlab用于求解規劃問題的工具包
推薦把這個工具整合到matlab中去,這個工具是私人的,不過大家都可以免費下載使用。下載后,只要在matlab中添加路徑就可以使用這工具箱。
正在吸引我的是,這個工具箱建立了一種新的數據類型,使所有規劃問題都整合在一起。
舉例如下:
已知非線性整數規劃為:
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<=800
x3+x4+5*x5<=200
在matlab中輸入 x=intvar(1,5);
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) 53 99 99 99 0
intvar(m,n):生成整數型變量;
sdpvar(m,n):生產變量;
solvesdp(F,f):求解最優解(最小值),其中F為約束條件(用set連接),f為目標函數
double:顯示求解的答案
intvar,sdpvar,生成的變量可以像矩陣一樣使用,如例題顯示。
代碼片段和文件信息
%?YALMIP
%?Version?3?(R14SP3)?14-Apr-2008
%
%?Information
%
%?Variables.
%???sdpvar???????-?Create?SDPVAR?variable?
%???intvar???????-?Create?integer?SDPVAR?variable
%???binvar???????-?Create?binary?SDPVAR?variable
%???blkvar???????-?Create?container?for?block?variable
%???double???????-?Convert?SDPVAR?object?to?double?(i.e.?extract?solution)
%???is???????????-?Check?property?of?SDPVAR?variable
%???setsdpvar????-?Initialize?the?“double“?value?of?an?SDPVAR?object
%???replace??????-?Replace?free?variables?in?an?SDPVAR?object?with?constant
%???sdisplay?????-?Tries?to?display?an?SDPVAR?symbolically
%???monolist?????-?Creates?multi-variate?monomials?up?to?specified?degree
%???linearize????-?Linearize?SDPVAR?object?p(x)?at?the?point?double(x)
%???jacobian?????-?Calculate?Jacobian?for?SDPVAR?object
%???hessian??????-?Calculate?Jacobian?for?SDPVAR?object
%???coefficients?-?Extract?coefficients?and?monomials?from?polynomials
%???unblkdiag????-?Detect?and?extract?blocks?in?SDP?constraints
%
%?Inequalites?and?constraints.
%???set??????????-?Create?a?SET?object?(set?of?constraints).?For?on-line?help:?help?sdpvar/set
%???sos??????????-?Create?sum-of-squares?constraint
%???cone?????????-?Second?order?cone?constraint
%???rcone????????-?Rotated?Lorentz?cone?constraint
%???integer??????-?Constrain?variables?to?be?integer
%???binary???????-?Constrain?variables?to?be?binary
%???unblkdiag????-?Extracts?diagonal?blocks
%???dissect??????-?Dissect?SDP?constraint
%???checkset?????-?Checks?constraint?violations?for?current?solution
%???dual?????????-?Extract?dual?variable?related?to?a?constraint?SET
%???sosd?????????-?Extract?SOS?decomposition
%???double???????-?Convert?SET?object?to?double
%???linearize????-?Linearize?all?constraints
%???is???????????-?Checks?property?of?constraint
%???plot?????????-?Plot?feasible?set.?For?on-line?help:?help?lmi/plot
%???hull?????????-?construct?convex?hull?of?SET?objects:?help?lmi/hull
%
%?Optimization?related.
%???sdpsettings??-?Create?an?options?structure
%???solvesdp?????-?Computes?solution?to?optimization?problem
%???solvesos?????-?Sum?of?squares?decomposition?of?polynomial
%???solvemoment??-?Lasserre‘s?moment?relaxation?for?polynomial?programming
%???solvemp??????-?Solve?multi-parametric?program
%
%?Auxillary
%???export???????-?Export?YALMIP?model?to?various?solver?formats
%???yalmip???????-?Various?administrative?stuff
%???savesdpafile?-?Saves?a?problem?definition?in?the?SDPA?format
%???yalmipdemo???-?Brief?tutorial?and?examples.
%???yalmiptest???-?Runs?a?number?of?test?problems.
%
%?Author?Johan?L鰂berg
%?$Id:?Contents.mv?1.50?2008/04/14?12:23:06?joloef?Exp?$???
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2379??2008-01-24?17:27??yalmip\@sdpvar\abs.m
?????文件????????933??2007-08-02?20:16??yalmip\@sdpvar\acos.m
?????文件????????924??2007-08-02?20:16??yalmip\@sdpvar\acosh.m
?????文件????????917??2007-08-02?20:16??yalmip\@sdpvar\acot.m
?????文件???????2378??2007-08-02?21:17??yalmip\@sdpvar\and.m
?????文件????????222??2006-07-26?22:17??yalmip\@sdpvar\any.m
?????文件????????925??2007-08-02?20:16??yalmip\@sdpvar\asec.m
?????文件????????932??2007-08-02?20:16??yalmip\@sdpvar\asin.m
?????文件????????875??2007-08-02?20:16??yalmip\@sdpvar\asinh.m
?????文件???????1658??2007-10-04?13:27??yalmip\@sdpvar\assign.m
?????文件????????902??2007-08-02?20:16??yalmip\@sdpvar\atan.m
?????文件????????615??2007-08-02?20:16??yalmip\@sdpvar\beta.m
?????文件????????869??2004-07-06?16:08??yalmip\@sdpvar\binary.m
?????文件???????2756??2007-09-12?16:28??yalmip\@sdpvar\blkdiag.m
?????文件???????1191??2006-05-11?12:49??yalmip\@sdpvar\bounds.m
?????文件????????300??2006-03-16?00:45??yalmip\@sdpvar\brutepersp.m
?????文件????????278??2006-08-10?10:48??yalmip\@sdpvar\cat.m
?????文件???????1213??2007-07-26?19:10??yalmip\@sdpvar\ceil.m
?????文件????????424??2006-07-26?22:17??yalmip\@sdpvar\circshift.m
?????文件????????954??2006-07-26?22:17??yalmip\@sdpvar\clean.m
?????文件????????406??2004-07-01?13:17??yalmip\@sdpvar\clearsdpvar.m
?????文件????????277??2007-04-12?13:31??yalmip\@sdpvar\clear_poly_dep.m
?????文件???????1003??2008-02-12?10:23??yalmip\@sdpvar\cone.m
?????文件????????214??2006-01-26?15:44??yalmip\@sdpvar\conj.m
?????文件???????6673??2004-07-06?16:09??yalmip\@sdpvar\Contents.m
?????文件????????673??2006-10-18?10:48??yalmip\@sdpvar\conv.m
?????文件?????????40??2007-07-29?23:09??yalmip\@sdpvar\convexhull.m
?????文件???????1849??2008-04-08?11:02??yalmip\@sdpvar\cos.m
?????文件????????982??2007-08-02?20:16??yalmip\@sdpvar\cosh.m
?????文件????????705??2007-08-02?20:16??yalmip\@sdpvar\cot.m
............此處省略951個文件信息
- 上一篇:量子聚類算法matlab實現
- 下一篇:基于DWT的數字水印算法的MatLab實現
評論
共有 條評論