数模论坛

 找回密码
 注-册-帐-号
搜索
热搜: 活动 交友 discuz
查看: 6630|回复: 5

用matlab解非线性(混合)整数规划

[复制链接]
发表于 2006-8-3 19:40:02 | 显示全部楼层 |阅读模式
<p>我下载了解非线性整数规划的函数BNB20(),也可以解线性的.但是不知道为什么总上是运行错误,这个函数应该是没有问题,是我从mathworks公司网站上下的 ,希望大家帮我看看到底是 怎么回事&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p><p>程序如下</p><p>function c6miopt(x)</p><p>f=-[2 1 4 3 1]*x&nbsp;;</p><p></p><p>&gt;&gt; a=[0 2 1 4 2;3 4 5 -1 -1];<br/>&gt;&gt; intlist=ones(5,1);<br/>&gt;&gt; aeq=[];<br/>&gt;&gt; beq=[];<br/>&gt;&gt; b=[54;62];<br/>&gt;&gt; ctype=[-1;-1];<br/>&gt;&gt; xm=[0 0 4 1 3]';<br/>&gt;&gt; xM=2000*ones(5,1);<br/>&gt;&gt; x0=xm;<br/>&gt;&gt; [err,f,x]=bnb20('c6miopt',x0,intlist,xm,xM,a,b,aeq,beq)</p><p>运行结果:</p><p>Warning: Could not find an exact (case-sensitive) match for 'bnb20'. D:\MATLAB701\sunbowork\BNB20.m is a case-insensitive match and will be used instead.&nbsp; You can improve the performance of your code by using exact name matches and we therefore recommend that you update your usage accordingly.&nbsp; Alternatively, you can disable this warning using warning('off','MATLAB:dispatcher:InexactMatch').<br/>*** searched&nbsp;&nbsp; 0 % of three<br/>*** Z&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Inf<br/>*** t&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.0 secs<br/>*** c&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 cycles<br/>*** fail :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 cycles<br/>Optimization terminated: first-order optimality measure less<br/>&nbsp;than options.TolFun and maximum constraint violation is less<br/>&nbsp;than options.TolCon.<br/>Active inequalities (to within options.TolCon = 1e-006):<br/>&nbsp; lower&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; upper&nbsp;&nbsp;&nbsp;&nbsp; ineqlin&nbsp;&nbsp; ineqnonlin<br/>&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>*** branch pruned<br/>*** new best solution found<br/><font color="#f70909">??? Error using ==&gt; horzcat<br/>The following error occurred converting from char to struct:<br/>Error using ==&gt; struct<br/>Conversion to struct from char is not possible.</font></p><p><font color="#f70909">Error in ==&gt; BNB20 at 388<br/>eval(['warning ',currentwarningstate]);</font></p><p></p>
 楼主| 发表于 2006-8-3 19:45:00 | 显示全部楼层
<p>下面这是bnb20函数的内容&nbsp; 大家可以copy回去 试着运行一下</p><p>function [errmsg,Z,X,t,c,fail] = BNB20(fun,x0,xstat,xl,xu,a,b,aeq,beq,nonlc,setts,opts,varargin);<br/>% BNB20 Finds the constrained minimum of a function of several possibly integer variables.<br/>% Usage: [errmsg,Z,X,t,c,fail] = <br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BNB20(fun,x0,xstatus,xlb,xub,A,B,Aeq,Beq,nonlcon,settings,options,P1,P2,...) <br/>%<br/>% BNB solves problems of the form:<br/>% Minimize F(x) subject to: xlb &lt;= x0 &lt;=xub<br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A*x &lt;= B&nbsp; Aeq*x=Beq<br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C(x)&lt;=0&nbsp; Ceq(x)=0<br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x(i) is continuous for xstatus(i)=0&nbsp; <br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x(i) integer for xstatus(i)= 1<br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x(i) fixed for xstatus(i)=2<br/>%<br/>% BNB uses:<br/>% Optimization Toolbox Version 2.0 (R11) 09-Oct-1998<br/>% From this toolbox fmincon.m is called. For more info type help fmincon.<br/>%<br/>% fun is the function to be minimized and should return a scalar. F(x)=feval(fun,x).<br/>% x0 is the starting point for x. x0 should be a column vector.<br/>% xstatus is a column vector describing the status of every variable x(i).<br/>% xlb and xub are column vectors with lower and upper bounds for x.<br/>% A and Aeq are matrices for the linear constrains.<br/>% B and Beq are column vectors for the linear constrains.<br/>% nonlcon is the function for the nonlinear constrains.<br/>% [C(x);Ceq(x)]=feval(nonlcon,x). Both C(x) and Ceq(x) should be column vectors.<br/>%<br/>% errmsg is a string containing an error message if BNB found an error in the input.<br/>% Z is the scalar result of the minimization, X the values of the accompanying variables. <br/>% t is the time elapsed while the algorithm BNB has run and c is the number of BNB cycles.<br/>% fail is the number of nonconvergent leaf sub-problems.<br/>%<br/>% settings is a row vector with settings for BNB:<br/>% settings(1) (standard 0) if 1: if the sub-problem does not converge do not branch it and<br/>% raise fail by one. Normally BNB will always branch a nonconvergent sub-problem so it can<br/>% try again to find a solution.<br/>% A sub-problem that is a leaf of the branch-and-bound-tree cannot be branched. If such<br/>% a problem does not converge it will be considered infeasible and fail will be raised by one.<br/>% settings(2) is the handle of main BNB GUI. Leave empty. <br/>% options is an options structure. For details type help optimset.<br/>% options.maxSQPiter is a variable used by fmincon (if modified as described in bnb20.m).<br/>% maxSQPiter cannot be set by optimset because it is not part of the standard options<br/>% structure. maxSQPiter is 1000 by default.<br/>% P1,P2,... are parameters to be passed to fun and nonlcon.<br/>% F(x)=feval(fun,x,P1,P2,...). [C(x);Ceq(x)]=feval(nonlcon,x,P1,P2,...).<br/>% Type edit BNB20 for more info.</p><p>% E.C. Kuipers<br/>% e-mail <a href="mailto:E.C.Kuipers@cpedu.rug.nl">E.C.Kuipers@cpedu.rug.nl</a>
                <br/>% FI-Lab<br/>% Applied Physics<br/>% Rijksuniversiteit Groningen</p><p>% To get rid of bugs and to stop fmincon from hanging make the following chances:<br/>%<br/>% In optim/private/nlconst.m ($Revision: 1.20 $&nbsp; $Date: 1998/08/24 13:46:15 $):<br/>% Get EXITFLAG independent of verbosity.<br/>% After the lines:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp('&nbsp; less than 2*options.TolFun but constraints are not satisfied.')&nbsp;&nbsp;&nbsp; <br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXITFLAG = -1;&nbsp;&nbsp; <br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br/>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; status=1;<br/>% add the line: if (strncmp(howqp, 'i',1) &amp; mg &gt; 0), EXITFLAG = -1; end;<br/>%<br/>% In optim/private/qpsub.m ($Revision: 1.21 $&nbsp; $Date: 1998/09/01 21:37:56 $):<br/>% Stop qpsub from hanging.<br/>% After the line: %&nbsp;&nbsp; Andy Grace 7-9-90. Mary Ann Branch 9-30-96.<br/>% add the line: global maxSQPIter; <br/>% and changed the line: maxSQPiters = Inf;<br/>% to the line: if exist('maxSQPiter','var'), maxSQPiters = maxSQPiter; else maxSQPiters=inf; end; <br/>% I guess there was a reason to put maxSQPiters at infinity, but this works fine for me.<br/>global maxSQPiter;</p><p>% STEP 0 CHECKING INPUT<br/>Z=[]; X=[]; t=0; c=0; fail=0;<br/>if nargin&lt;2, errmsg='BNB needs at least 2 input arguments.'; return; end;<br/>if isempty(fun), errmsg='No fun found.'; return;<br/>elseif ~ischar(fun), errmsg='fun must be a string.'; return; end;<br/>if isempty(x0), errmsg='No x0 found.'; return;<br/>elseif ~isnumeric(x0) | ~isreal(x0) | size(x0,2)&gt;1<br/>&nbsp;&nbsp; errmsg='x0 must be a real column vector.'; return;<br/>end;<br/>xstatus=zeros(size(x0));<br/>if nargin&gt;2 &amp; ~isempty(xstat)<br/>&nbsp;&nbsp; if isnumeric(xstat) &amp; isreal(xstat) &amp; all(size(xstat)&lt;=size(x0))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if all(xstat==round(xstat) &amp; 0&lt;=xstat &amp; xstat&lt;=2)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xstatus(1:size(xstat))=xstat;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else errmsg='xstatus must consist of the integers 0,1 en 2.'; return; end;<br/>&nbsp;&nbsp; else errmsg='xstatus must be a real column vector the same size as x0.'; return; end;<br/>end;<br/>xlb=zeros(size(x0));<br/>xlb(find(xstatus==0))=-inf;<br/>if nargin&gt;3 &amp; ~isempty(xl)<br/>&nbsp;&nbsp; if isnumeric(xl) &amp; isreal(xl) &amp; all(size(xl)&lt;=size(x0))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlb(1:size(xl,1))=xl;<br/>&nbsp;&nbsp; else errmsg='xlb must be a real column vector the same size as x0.'; return; end;<br/>end;<br/></p>
 楼主| 发表于 2006-8-3 19:45:43 | 显示全部楼层
if any(x0&lt;xlb), errmsg='x0 must be in the range xlb &lt;= x0.'; return;<br/>elseif any(xstatus==1 &amp; (~isfinite(xlb) | xlb~=round(xlb)))<br/>&nbsp;&nbsp; errmsg='xlb(i) must be an integer if x(i) is an integer variabele.'; return;<br/>end;<br/>xlb(find(xstatus==2))=x0(find(xstatus==2));<br/>xub=ones(size(x0));<br/>xub(find(xstatus==0))=inf;<br/>if nargin&gt;4 &amp; ~isempty(xu)<br/>&nbsp;&nbsp; if isnumeric(xu) &amp; isreal(xu) &amp; all(size(xu)&lt;=size(x0))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xub(1:size(xu,1))=xu;<br/>&nbsp;&nbsp; else errmsg='xub must be a real column vector the same size as x0.'; return; end;<br/>end;<br/>if any(x0&gt;xub), errmsg='x0 must be in the range x0 &lt;=xub.'; return;<br/>elseif any(xstatus==1 &amp; (~isfinite(xub) | xub~=round(xub)))<br/>&nbsp;&nbsp; errmsg='xub(i) must be an integer if x(i) is an integer variabale.'; return;<br/>end;<br/>xub(find(xstatus==2))=x0(find(xstatus==2));<br/>A=[];<br/>if nargin&gt;5 &amp; ~isempty(a)<br/>&nbsp;&nbsp; if isnumeric(a) &amp; isreal(a) &amp; size(a,2)==size(x0,1), A=a;<br/>&nbsp;&nbsp; else errmsg='Matrix A not correct.'; return; end;<br/>end;<br/>B=[];<br/>if nargin&gt;6 &amp; ~isempty(b)<br/>&nbsp;&nbsp; if isnumeric(b) &amp; isreal(b) &amp; all(size(b)==[size(A,1) 1]), B=b;<br/>&nbsp;&nbsp; else errmsg='Column vector B not correct.'; return; end;<br/>end;<br/>if isempty(B) &amp; ~isempty(A), B=zeros(size(A,1),1); end;<br/>Aeq=[];<br/>if nargin&gt;7 &amp; ~isempty(aeq)<br/>&nbsp;&nbsp; if isnumeric(aeq) &amp; isreal(aeq) &amp; size(aeq,2)==size(x0,1), Aeq=aeq;<br/>&nbsp;&nbsp; else errmsg='Matrix Aeq not correct.'; return; end;<br/>end;<br/>Beq=[];<br/>if nargin&gt;8 &amp; ~isempty(beq)<br/>&nbsp;&nbsp; if isnumeric(beq) &amp; isreal(beq) &amp; all(size(beq)==[size(Aeq,1) 1]), Beq=beq;<br/>&nbsp;&nbsp; else errmsg='Column vector Beq not correct.'; return; end;<br/>end;<br/>if isempty(Beq) &amp; ~isempty(Aeq), Beq=zeros(size(Aeq,1),1); end;<br/>nonlcon='';<br/>if nargin&gt;9 &amp; ~isempty(nonlc)<br/>&nbsp;&nbsp; if ischar(nonlc), nonlcon=nonlc; <br/>&nbsp;&nbsp; else errmsg='fun must be a string.'; return; end;<br/>end;<br/>settings = [0 0];<br/>if nargin&gt;10 &amp; ~isempty(setts)<br/>&nbsp;&nbsp; if isnumeric(setts) &amp; isreal(setts) &amp; all(size(setts)&lt;=size(settings))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; settings(setts~=0)=setts(setts~=0);<br/>&nbsp;&nbsp; else errmsg='settings should be a row vector of length 1 or 2.'; return; end;<br/>end;<br/>maxSQPiter=1000;<br/>options=optimset('fmincon');<br/>if nargin&gt;11 &amp; ~isempty(opts)<br/>&nbsp;&nbsp; if isstruct(opts)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if isfield(opts,'MaxSQPIter')<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if isnumeric(opts.MaxSQPIter) &amp; isreal(opts.MaxSQPIter) &amp; ...<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all(size(opts.MaxSQPIter)==1) &amp; opts.MaxSQPIter&gt;0 &amp; ...<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; round(opts.MaxSQPIter)==opts.MaxSQPIter<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxSQPiter=opts.MaxSQPIter;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; opts=rmfield(opts,'MaxSQPIter');<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else errmsg='options.maxSQPiter must be an integer &gt;0.'; return; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; options=optimset(options,opts);<br/>&nbsp;&nbsp; else errmsg='options must be a structure.'; return; end;<br/>end;<br/>evalreturn=0;<br/>eval(['z=',fun,'(x0,varargin{:});'],'errmsg=''fun caused error.''; evalreturn=1;');<br/>if evalreturn==1, return; end;<br/>if ~isempty(nonlcon)<br/>&nbsp;&nbsp; eval(['[C, Ceq]=',nonlcon,'(x0,varargin{:});'],'errmsg=''nonlcon caused error.''; evalreturn=1;');<br/>&nbsp;&nbsp; if evalreturn==1, return; end;<br/>&nbsp;&nbsp; if size(C,2)&gt;1 | size(Ceq,2)&gt;1, errmsg='C en Ceq must be column vectors.'; return; end;<br/>end;<p>% STEP 1 INITIALISATION<br/>currentwarningstate=warning;<br/>warning off;<br/>tic;<br/>lx = size(x0,1);<br/>z_incumbent=inf;<br/>x_incumbent=inf*ones(size(x0));<br/>I = ceil(sum(log2(xub(find(xstatus==1))-xlb(find(xstatus==1))+1))+size(find(xstatus==1),1)+1);<br/>stackx0=zeros(lx,I);<br/>stackx0(:,1)=x0;<br/>stackxlb=zeros(lx,I);<br/>stackxlb(:,1)=xlb;<br/>stackxub=zeros(lx,I);<br/>stackxub(:,1)=xub;<br/>stackdepth=zeros(1,I);<br/>stackdepth(1,1)=1;<br/>stacksize=1;<br/>xchoice=zeros(size(x0));<br/>if ~isempty(Aeq)<br/>&nbsp;&nbsp; j=0;<br/>&nbsp;&nbsp; for i=1:size(Aeq,1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if Beq(i)==1 &amp; all(Aeq(i,==0 | Aeq(i,==1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; J=find(Aeq(i,==1);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if all(xstatus(J)~=0 &amp; xchoice(J)==0 &amp; xlb(J)==0 &amp; xub(J)==1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if all(xstatus(J)~=2) | all(x0(J(find(xstatus(J)==2)))==0)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j=j+1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xchoice(J)=j;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if sum(x0(J))==0, errmsg='x0 not correct.'; return; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp; end;<br/>end;<br/>errx=optimget(options,'TolX');<br/>handleupdate=[];<br/>if ishandle(settings(2))<br/>&nbsp;&nbsp; taghandlemain=get(settings(2),'Tag');<br/>&nbsp;&nbsp; if strcmp(taghandlemain,'main BNB GUI')<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; handleupdate=guiupd;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; handleupdatemsg=findobj(handleupdate,'Tag','updatemessage');<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bnbguicb('hide main');<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; drawnow;<br/>&nbsp;&nbsp; end;<br/>end;<br/>optionsdisplay=getfield(options,'Display');<br/>if strcmp(optionsdisplay,'iter') | strcmp(optionsdisplay,'final')<br/>&nbsp;&nbsp; show=1;<br/>else show=0; end;</p><p>% STEP 2 TERMINIATION<br/>while stacksize&gt;0<br/>&nbsp;&nbsp; c=c+1;<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp; % STEP 3 LOADING OF CSP<br/>&nbsp;&nbsp; x0=stackx0(:,stacksize);<br/>&nbsp;&nbsp; xlb=stackxlb(:,stacksize);<br/>&nbsp;&nbsp; xub=stackxub(:,stacksize);<br/>&nbsp;&nbsp; x0(find(x0&lt;xlb))=xlb(find(x0&lt;xlb));<br/>&nbsp;&nbsp; x0(find(x0&gt;xub))=xub(find(x0&gt;xub));<br/>&nbsp;&nbsp; depth=stackdepth(1,stacksize);<br/>&nbsp;&nbsp; stacksize=stacksize-1;<br/>&nbsp;&nbsp; percdone=round(100*(1-sum(0.5.^(stackdepth(1stacksize+1))-1))));<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp; % UPDATE FOR USER<br/>&nbsp;&nbsp; if ishandle(handleupdate) &amp; strcmp(get(handleupdate,'Tag'),'update BNB GUI')<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t=toc;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; updatemsg={ ...<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf('searched %3d %% of three',percdone) ...<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf('Z&nbsp;&nbsp;&nbsp; : %12.4e',z_incumbent) ...<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf('t&nbsp;&nbsp;&nbsp; : %12.1f secs',t) ...<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf('c&nbsp;&nbsp;&nbsp; : %12d cycles',c-1) ...<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf('fail : %12d cycles',fail)};<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set(handleupdatemsg,'String',updatemsg);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; drawnow;<br/>&nbsp;&nbsp; else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp(sprintf('*** searched %3d %% of three',percdone));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp(sprintf('*** Z&nbsp;&nbsp;&nbsp; : %12.4e',z_incumbent));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp(sprintf('*** t&nbsp;&nbsp;&nbsp; : %12.1f secs',t));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp(sprintf('*** c&nbsp;&nbsp;&nbsp; : %12d cycles',c-1));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp(sprintf('*** fail : %12d cycles',fail));<br/>&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;<br/>&nbsp;</p>
 楼主| 发表于 2006-8-3 19:46:29 | 显示全部楼层
&nbsp; % STEP 4 RELAXATION<br/>&nbsp;&nbsp; [x z convflag]=fmincon(fun,x0,A,B,Aeq,Beq,xlb,xub,nonlcon,options,varargin{:});<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp; % STEP 5 FATHOMING<br/>&nbsp;&nbsp; K = find(xstatus==1 &amp; xlb~=xub);<br/>&nbsp;&nbsp; separation=1;<br/>&nbsp;&nbsp; if convflag&lt;0 | (convflag==0 &amp; settings(1))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % FC 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; separation=0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if show, disp('*** branch pruned'); end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if convflag==0,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fail=fail+1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if show, disp('*** not convergent'); end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elseif show, disp('*** not feasible');<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp; elseif z&gt;=z_incumbent &amp; convflag&gt;0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % FC 2<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; separation=0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if show<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp('*** branch pruned');<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp('*** ghosted'); <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp; elseif all(abs(round(x(K))-x(K))&lt;errx) &amp; convflag&gt;0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % FC 3<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; z_incumbent = z;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x_incumbent = x;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; separation = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if show<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp('*** branch pruned');<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp('*** new best solution found');<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;&nbsp;&nbsp; <br/>&nbsp;&nbsp; end;<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp; % STEP 6 SELECTION<br/>&nbsp;&nbsp; if separation == 1 &amp; ~isempty(K)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dzsep=-1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for i=1:size(K,1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dxsepc = abs(round(x(K(i)))-x(K(i)));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if dxsepc&gt;=errx | convflag==0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xsepc = x; xsepc(K(i))=round(x(K(i)));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dzsepc = abs(feval(fun,xsepc,varargin{:})-z);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if dzsepc&gt;dzsep<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dzsep=dzsepc;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ixsep=K(i);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % STEP 7 SEPARATION<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if xchoice(ixsep)==0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % XCHOICE==0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; branch=1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domain=[xlb(ixsep) xub(ixsep)];<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sepdepth=depth;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while branch==1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xboundary=(domain(1)+domain(2))/2;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if x(ixsep)&lt;xboundary<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainA=[domain(1) floor(xboundary)];<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainB=[floor(xboundary+1) domain(2)];<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainA=[floor(xboundary+1) domain(2)];<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainB=[domain(1) floor(xboundary)];<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sepdepth=sepdepth+1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stacksize=stacksize+1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackx0(:,stacksize)=x;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxlb(:,stacksize)=xlb;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxlb(ixsep,stacksize)=domainB(1);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxub(:,stacksize)=xub;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxub(ixsep,stacksize)=domainB(2);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackdepth(1,stacksize)=sepdepth;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if domainA(1)==domainA(2) <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stacksize=stacksize+1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackx0(:,stacksize)=x;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxlb(:,stacksize)=xlb;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxlb(ixsep,stacksize)=domainA(1);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxub(:,stacksize)=xub;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxub(ixsep,stacksize)=domainA(2);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackdepth(1,stacksize)=sepdepth;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; branch=0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domain=domainA;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; branch=1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % XCHOICE~=0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; L=find(xchoice==xchoice(ixsep));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; M=intersect(K,L);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [dummy,N]=sort(x(M));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; part1=M(N(1:floor(size(N)/2))); part2=M(N(floor(size(N)/2)+1:size(N)));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sepdepth=depth+1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stacksize=stacksize+1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackx0(:,stacksize)=x;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O = (1-sum(stackx0(part1,stacksize)))/size(part1,1);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackx0(part1,stacksize)=stackx0(part1,stacksize)+O;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxlb(:,stacksize)=xlb;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxub(:,stacksize)=xub;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxub(part2,stacksize)=0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackdepth(1,stacksize)=sepdepth;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stacksize=stacksize+1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackx0(:,stacksize)=x;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O = (1-sum(stackx0(part2,stacksize)))/size(part2,1);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackx0(part2,stacksize)=stackx0(part2,stacksize)+O;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxlb(:,stacksize)=xlb;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxub(:,stacksize)=xub;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackxub(part1,stacksize)=0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stackdepth(1,stacksize)=sepdepth;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp; elseif separation==1 &amp; isempty(K)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fail=fail+1;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if show<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp('*** branch pruned');<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disp('*** leaf not convergent');<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<br/>&nbsp;&nbsp; end;<br/>end;<p>% STEP 8 OUTPUT&nbsp; <br/>t=toc;<br/>Z = z_incumbent;<br/>X = x_incumbent;<br/>errmsg='';</p><p>if ishandle(handleupdate)<br/>&nbsp;&nbsp; taghandleupdate=get(handleupdate,'Tag');<br/>&nbsp;&nbsp; if strcmp(taghandleupdate,'update BNB GUI')<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; close(handleupdate);<br/>&nbsp;&nbsp; end;<br/>end;</p><p>eval(['warning ',currentwarningstate]);</p>
发表于 2006-8-7 17:44:27 | 显示全部楼层
<p>三段放一起运行迈?</p><p></p>
发表于 2006-8-23 07:18:11 | 显示全部楼层
<p>我的运行结果为:</p><p>err =</p><p>fun caused error.</p><p><br/>f =</p><p>&nbsp;&nbsp;&nbsp;&nbsp; []</p><p><br/>x =</p><p>&nbsp;&nbsp;&nbsp;&nbsp; []</p>
您需要登录后才可以回帖 登录 | 注-册-帐-号

本版积分规则

小黑屋|手机版|Archiver|数学建模网 ( 湘ICP备11011602号 )

GMT+8, 2024-11-28 01:37 , Processed in 0.060173 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表