多目标非线性规划程序(Matlab)_第1页
多目标非线性规划程序(Matlab)_第2页
多目标非线性规划程序(Matlab)_第3页
多目标非线性规划程序(Matlab)_第4页
多目标非线性规划程序(Matlab)_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

function errmsg Z X t c fail BNB18 fun x0 xstat xl xu A B Aeq Beq nonlcon setts options1 options2 ma xSQPit varargin MATLAB5 3 Optimizat ion toolbox 2 0 Minimize F x subject to xlb x xub A x B Aeq x Beq C x 0 x1 2 x2 2 x3 72 10 x2 20 x1 x2 10 M discfun m function f discfun x f x 1 x 2 x 3 clear x0 25 15 10 xstat 1 1 1 xl 20 10 10 xu 30 20 20 A 1 2 2 1 2 2 B 0 72 Aeq 1 1 0 Beq 10 err Z X BNB18 discfun x0 xstat xl xu A B Aeq Beq XMAX X ZMAX Z BNB18 Finds the constrained minimum of a function of several possibly integer variables Usage errmsg Z X t c fail BNB18 fun x0 xstatus xlb xub A B Aeq Beq nonlcon settings options1 opti ons2 maxSQPiter P1 P2 BNB solves problems of the form Minimize F x subject to xlb x0 xub A x B Aeq x Beq C x 0 EXITFLAG 1 end In optim private qpsub m Revision 1 21 Date 1998 09 01 21 37 56 Stop qpsub from hanging After the line Andy Grace 7 9 90 Mary Ann Branch 9 30 96 add the line global maxSQPiter and changed the line maxSQPiters Inf to the line if exist maxSQPiter var maxSQPiters maxSQPiter else maxSQPiters inf end I guess there was a reason to put maxSQPiters at infinity but this works fine for me global maxSQPiter STEP 0 CHECKING INPUT Z X t 0 c 0 fail 0 if nargin1 errmsg x0 must be a column vector return end xstatus zeros size x0 if nargin 2 else errmsg xstatus must be a column vector the same size as x0 return end if any xstatus round xstatus xstatus 0 23 else errmsg xlb must be a column vector the same size as x0 return end end if any x0 xlb errmsg x0 must be in the range xlb 4 return end else A end if nargin 6 if isempty B return end else B end if isempty A return end if isempty B end if nargin 7 return end else Aeq end if nargin 8 if isempty Beq return end else Beq end if isempty Aeq return end if isempty Beq end if nargin10 else errmsg settings should be a row vector of length 3 return end end if nargin 12 options1 end options1 optimset optimset fmincon options1 if nargin 13 options2 end options2 optimset optimset fmincon options2 if nargin0 else errmsg maxSQPiter must be an integer 0 return end eval z fun x0 varargin errmsg fun caused error return if isempty nonlcon eval C Ceq nonlcon x0 varargin errmsg nonlcon caused error return if size C 2 1 size Ceq 2 1 errmsg C en Ceq must be column vectors return end end STEP 1 INITIALISATION currentwarningstate warning warning off tic lx size x0 1 z incumbent inf x incumbent inf ones size x0 I ceil sum log2 xub find xstatus 1 xlb find xstatus 1 1 size find xstatus 1 1 1 stackx0 zeros lx I stackx0 1 x0 stackxlb zeros lx I stackxlb 1 xlb stackxub zeros lx I stackxub 1 xub stacksize 1 xchoice zeros size x0 if isempty Aeq j 0 for i 1 size Aeq 1 if Beq i 1 if all xstatus J 0 xchoice J j if sum x0 J 0 errmsg x0 not correct return end end end end end end errx optimget options2 TolX errcon optimget options2 TolCon fail 0 c 0 STEP 2 TERMINIATION while stacksize 0 c c 1 STEP 3 LOADING OF CSP x0 stackx0 stacksize xlb stackxlb stacksize xub stackxub stacksize x0 find x0 xlb xlb find x0 xub xub find x0 xub stacksize stacksize 1 STEP 4 RELAXATION PHASE 1 con BNBCON x0 A B Aeq Beq xlb xub nonlcon varargin if abs con errcon if settings 3 if con0 x z convflag fmincon fun x1 A B Aeq Beq xlb xub nonlcon options2 varargin if settings 3 if con errcon convflag 1 end end else convflag feasflag end STEP 5 FATHOMING K find xstatus 1 separation 1 if convflag z incumbent elseif all abs round x K x K 0 FC 3 z incumbent z x incumbent x separation 0 end STEP 6 SELECTION if separation 1 for i 1 size K 1 dxsepc abs round x K i x K i if dxsepc errx convflag 0 xsepc x xsepc K i round x K i dzsepc abs feval fun xsepc varargin z if dzsepc dzsep dzsep dzsepc ixsep K i end end end STEP 7 SEPARATION if xchoice ixsep 0 XCHOICE 0 branch 1 domain xlb ixsep xub ixsep while branch 1 xboundary domain 1 domain 2 2 if x ixsep xboundary domainA domain 1 floor xboundary domainB floor xboundary 1 domain 2 else domainA floor xboundary 1 domain 2 domainB domain 1 floor xboundary end stacksize stacksize 1 stackx0 stacksize x stackxlb stacksize xlb stackxlb ixsep stacksize domainB 1 stackxub stacksize xub stackxub ixsep stacksize domainB 2 if domainA 1 domainA 2 stacksize stacksize 1 stackx0 stacksize x stackxlb stacksize xlb stackxlb ixsep stacksize domainA 1 stackxub stacksize xub stackxub ixsep stacksize domainA 2 branch 0 else domain domainA branch 1 end end else XCHOICE 0 L find xchoice xchoice ixsep M intersect K L dummy N sort x M part1 M N 1 floor size N 2 part2 M N floor size N 2 1 size N stacksize stacksize 1 stackx0 stacksize x O 1 sum stackx0 part1 stacksize size part1 1 stackx0 part1 stacksize stackx0 part1 stacksize O stackxlb stacksize xlb stackxub stacksize xub stackxub part2 stacksize 0 stacksize stacksize 1 stackx0 stacksize x O 1 sum stackx0 part2 stacksize size part2 1 stackx0 part2 stacksize stackx0 part2 stacksize O stackxlb stacksize xlb stackxub stacksize xub stackxub part1 stacksize 0 if size part2 1 1 stackxlb part2 stacksize 1 end end elseif separation 1 end end STEP 8 OUTPUT t toc Z z incumbent X x incumbent errmsg eval warning currentwarningstate function CON BNBCON x A B Aeq Beq xlb xub nonlc

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论