📄 checkin.m
字号:
function [m, n, X, LB, UB, f, c, Aset, Abounds, exit] = CheckIn(ffun,cfun,X0,Teq,Tineq,LBin,UBin,Maxit,params)
%Call: [m, n, X, LB, UB, f, c, Aset, Abounds, exit] = CheckIn(ffun,cfun,X0,Teq,Tineq,LBin,UBin,Maxiter,params)
%Check the input parameters and do some initial evaluation.
%Aset holds indeces of general constraints in first working set.
%Make X0 feasible if it is not.
%Abounds(j) indicate wether or not variable number j attains either the lower or the upper bound.
%Abounds(j)=1 if the lower bound is attained, = -1 if the upper bound is attained, = 0 otherwise.
%exit is set to < 0 if the computing should be terminated.
%Otherwise exit is set to zero.
%
exit = 0;
X = X0(:);
LB = LBin(:);
UB = UBin(:);
n = max(size(X0));
Abounds = zeros(n,1);
if n == max(size(LB))
i = find(X<=LB);
X(i)=LB(i);
Abounds(i) = 1;
else
exit = -1;
end
if n == max(size(UB))
j = find(X>=UB);
X(j) = UB(j);
Abounds(j) = -1;
else
exit = -1;
end
if Maxit < 0
exit = exit-10;
end
Aset = 1:Teq;
%Evaluate the residuals and the constraints at X0
if exit == 0
[f Dummy] = feval(ffun,X,0,params{:});
[c Dummy] = feval(cfun,X,0,params{:});
m = max(size(f));
IndNeg = find(c(Teq+1:Teq+Tineq) <= 0);
if (max(size(IndNeg))+Teq) <= n
Aset = [Aset IndNeg];
else
disp('Checkin: Starting point is too infeasible')
exit = exit-1000;
end
else
f=[]; c=[];
end
if Teq > n
exit = exit-100;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -