📄 addbounds.m
字号:
function [F_struc,K] = addbounds(F_struc,K,ub,lb)
%ADDBOUNDS Internal function to add variable bounds to an F_struc
% Author Johan L鰂berg
% $Id: addbounds.m,v 1.3 2005/02/10 16:43:32 johanl Exp $
% Upper bounds
finite_bounds = find(~isinf(ub));
if ~isempty(finite_bounds)
p = length(finite_bounds);
n = length(ub);
if ~isempty(F_struc)
F_struc = [F_struc(1:1:K.f,:);[ub(finite_bounds) -sparse(1:p,finite_bounds,ones(p,1),p,n)];F_struc(K.f+1:end,:)];
else
F_struc = [ub(finite_bounds) -sparse(1:p,finite_bounds,ones(p,1),p,n)];
end
K.l = K.l+p;
end
% Lower bounds
finite_bounds = find(~isinf(lb));
if ~isempty(finite_bounds)
p = length(finite_bounds);
n = length(ub);
if ~isempty(F_struc)
F_struc = [F_struc(1:1:K.f,:);[-lb(finite_bounds) sparse(1:p,finite_bounds,ones(p,1),p,n)];F_struc(K.f+1:end,:)];
else
F_struc = [[-lb(finite_bounds) sparse(1:p,finite_bounds,ones(p,1),p,n)];F_struc(K.f+1:end,:)];
end
K.l = K.l+p;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -