extract_bounds_from_abs_operator.m

来自「matlab波形优化算法经常要用到的matlab toolbox工具箱:yalm」· M 代码 · 共 28 行

M
28
字号
function LU = extract_bounds_from_abs_operator(LU,extstruct,extvariables);
for i = 1:length(extstruct)
    if isequal(extstruct(i).fcn,'abs')
        arg = extstruct(i).arg{1};
        if is(arg,'lpcone') & isreal(arg)
            vars = getvariables(arg);
            % Absolute value larger than 0
            LU(extvariables(i),1) = max([0 LU(extvariables(i),1)]);
            % Upper bound on linear smaller than abs upper bound
            LU(vars,2) = min([LU(vars,2) LU(extvariables(i),2)]);
            % Lower bound larger than -abs upper
            LU(vars,1) = max([LU(vars,1) -LU(extvariables(i),2)]);
            % Absolute upper bound smaller than max(abs(linear bounds))
            LU(extvariables(i),2) = max(abs(LU(vars,:)));
        elseif isreal(arg) & size(arg,1)==1
            absmax = abs(getbase(arg))*[1;max(abs(LU(getvariables(arg),:)),[],2)];
             LU(extvariables(i),1) = max([0 LU(extvariables(i),1)]);
             LU(extvariables(i),2) = min([absmax LU(extvariables(i),2)]);
        else
            % At least fix lower bound on absolute
            LU(extvariables(i),1) = max([0 LU(extvariables(i),1)]);
        end
    elseif isequal(extstruct(i).fcn,'norm')
        % norms are positive...
        LU(extvariables(i),1) = max([0 LU(extvariables(i),1)]);
    end
end

⌨️ 快捷键说明

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