⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tightenbounds.m

📁 国外专家做的求解LMI鲁棒控制的工具箱,可以相对高效的解决LMI问题
💻 M
字号:
function [lb,ub,redundant,psstruct] = tightenbounds(A,b,lb,ub,integer_variables,binary_variables,changed_bounds);
%TIGHTENBOUNDS Internal function to perform bound tightening

% Author Johan L鰂berg
% $Id: tightenbounds.m,v 1.8 2005/06/24 16:04:34 joloef Exp $

% Simple bound pre-processing (paper by Savelsbergh)
% No code optimization at all
% 
% AA=A;
% bb=b;
% cVar = setdiff(1:size(A,2),binary_variables);
% binaryCliques = find(sum(A(:,cVar)~=0,2)==0);
% if ~isempty(binaryCliques)
%     A = A(binaryCliques,:);
%     b = b(binaryCliques);
%     for i = 1:length(binaryCliques);
%         [dummy,variable,vals] = find(A(i,:));
%         if all(vals == -1)
%             lowerbound = -b(i);
%             zeroConstrained = find(ub(variable)==0);
%             if length(zeroConstrained)==length(variable)-lowerbound
%                 notzeroConstrained = find(ub(variable)~=0);
%                 lb(variable(notzeroConstrained))=1;
%             end
%             if length(zeroConstrained)>length(variable)-lowerbound
%                 notzeroConstrained = find(ub(variable)~=0);
%                 lb(variable(notzeroConstrained))=2;
%             end
%         end
%     end
% end
% A=AA;
% b = bb;

ubnew = ub;
lbnew = lb;
goon = 1;

AL0A  = (A>0).*A;
AG0A  = (A<0).*A;

goon = all(lb<=ub);
At = A';
use_indicies=ones(length(b),1);
used = full(any(A(:,find(changed_bounds)),2));
isbinary  = ismembc(1:length(lb),binary_variables);
isinteger = ismembc(1:length(lb),binary_variables);

%prob.A = A;prob.b_L = b-inf;prob.b_U = b;prob.x_L = lb;prob.x_U = ub;prob.PriLevOpt=0;prob.MIP.IntVars = binary_variables;
%prob = preSolve(prob);

while goon
    
    bi_up = AL0A*ub+AG0A*lb;
    bi_dn = AL0A*lb+AG0A*ub;
    
    bminusbdn=b-bi_dn;
    for i = find(use_indicies & used)'
                
        [ii,jj,kk] = find(At(:,i));

        Cp = ii(kk>0);
        Cm = ii(kk<0);
        
         new1=lbnew(Cp)+bminusbdn(i)./At(Cp,i);
         new2=ubnew(Cm)+bminusbdn(i)./At(Cm,i);
         %b1=new1<ubnew(Cp);
         %b2=new2>lbnew(Cm);
         %if any(b1)
         ubnew(Cp)=min(ubnew(Cp),new1);
         %end
         %if any(b2)
         lbnew(Cm)=max(lbnew(Cm),new2);
         %end

%         for j = Cp(:)'
%             ubnew(j) = min(ubnew(j),lbnew(j)+(b(i)-bi_dn(i))/A(i,j));
%         end
%         for j=Cm(:)'
%             lbnew(j) = max(lbnew(j),ubnew(j)+(b(i)-bi_dn(i))/A(i,j));
%         end         
        
    end
       
%    lbnew(integer_variables) = fix(lbnew(integer_variables));
%    ubnew(integer_variables) = fix(ubnew(integer_variables));
    
    lbnew(integer_variables) = round(lbnew(integer_variables)+0.49999);
    ubnew(integer_variables) = round(ubnew(integer_variables)-0.49999);
   
    lbnew(binary_variables) = round(lbnew(binary_variables)+0.49999);
    ubnew(binary_variables) = round(ubnew(binary_variables)-0.49999);

    goon = (~all((lb==lbnew) & (ub==ubnew))) & all(lbnew<=ubnew);    
    
    used = (lb~=lbnew) | (ub~=ubnew);
    used = full(any(A(:,find(used)),2));
    
    lb = lbnew;
    ub = ubnew;
    
    use_indicies = use_indicies & bi_up>b;    
end

%lb = prob.x_L;
%ub = prob.x_U;
redundant = [];%find(bi_up<=b);
psstruct.AL0A = AL0A;
psstruct.AG0A = AG0A;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -