📄 propagateresect.m
字号:
function [outrect] = propagateresect(inrect, index, Xlist, nbrpoints, m, n);%inrect = inrect1old;%index = index2;%keyboard;if (index > n+1) conset = [2:n, index]; remset = [n+1:index-1, index+1:nbrpoints];else conset = [2:n+1]; remset = [n+2:nbrpoints];endfor i = 1:nAmax(i,:) = -Xlist(:,conset(i))';bmax(i,1) = -inrect.sllist(conset(i));endfor i = 1:nAmin(i,:) = Xlist(:,conset(i))';bmin(i,1) = inrect.sulist(conset(i));endA = [Amax;Amin];b = [bmax;bmin];%size(Amax)%size(Amin)%size(A)%size(bmax)%size(bmin)%size(b)%keyboard;options = optimset('Display','off');options = optimset(options,'LargeScale','off');for i = 1:length(remset) f = Xlist(:,remset(i)); g = -f; [xtmp,lsolset(i),exitflag1] = linprog(f, A, b,[],[],[],[],[],options); [xtmp,usolset(i),exitflag2] = linprog(g, A, b,[],[],[],[],[],options);endif exitflag1 ~= 1disp('Error propagating lower bounds. Setting to minus infinity.');lsolset = -Inf*ones(size(remset));endif exitflag2 ~= 1disp('Error propagating upper bounds. Setting to infinity.')usolset = Inf*ones(size(remset));endoutrect = inrect;outrect.sllist(conset) = inrect.sllist(conset);outrect.sllist(remset) = lsolset;outrect.sulist(conset) = inrect.sulist(conset);outrect.sulist(remset) = -usolset;% outrectlretainlist = inrect.sllist;lindretain = find(outrect.sllist > inrect.sllist);lretainlist(lindretain) = outrect.sllist(lindretain);uretainlist = inrect.sulist;uindretain = find(outrect.sulist < inrect.sulist);uretainlist(uindretain) = outrect.sulist(uindretain);outrect.sllist = lretainlist;outrect.sulist = uretainlist;%(outrect.sulist(end)-outrect.sllist(end))-(inrect.sulist(end)-inrect.sllist(end))%%if length(lindretain) > 0%fprintf('Lower bound propagated: %d : ', length(lindretain))%fprintf('%d ', lindretain);%fprintf('\n');%%end%%if length(uindretain) > 0%fprintf('Upper bound propagated: %d : ', length(uindretain))%fprintf('%d ', uindretain);%fprintf('\n\n');%%end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -