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

📄 bounds.m

📁 optimization toolbox
💻 M
字号:
function varargout = bounds(x,lower,upper,aux)
%BOUNDS Adds implicit bounds on variables.
%
% BOUNDS IS OBSOLETE: Use standard SET constraints
%
% BOUNDS(x,Lower,Upper)   Adds bound constraints on variables.
%                         These bounds are used when performing
%                         big M formulations and similar things.

% Author Johan L鰂berg 
% $Id: bounds.m,v 1.6 2006/05/11 10:49:13 joloef Exp $   

variables = getvariables(x);
if nargin == 1
    lb = yalmip('getbounds',variables);
    lower = lb(:,1);
    upper = lb(:,2);
else
    lower = lower(:);
    upper = upper(:);
    if length(lower)==1
        lower = repmat(lower,length(variables),1);
    end
    if length(upper)==1
        upper = repmat(upper,length(variables),1);
    end
    % 0 - No problems
    % 1 - Trying to bound nonlinear variable
    % 2 - Trying to bound nonlinear operator     
    fail = yalmip('setbounds',variables,lower,upper);
    switch fail
        case {1,2}
            error('BOUNDS can only be applied to linear unitary SDPVAR variables.')
        otherwise
    end
end

if nargout>0
    varargout{1} = lower;
    varargout{2} = upper;
end

⌨️ 快捷键说明

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