-
Notifications
You must be signed in to change notification settings - Fork 0
/
findFreePos.m
43 lines (35 loc) · 1.5 KB
/
findFreePos.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%% findFreePos.m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function [point,par,info]=findFreePos(point,par,info)
% update local and determine activity
%
% for details of input and output structures see lmbopt.m
function [point,par,info]=findFreePos(point,par,info)
rho = (1/max(1,info.ng-1));
par.freeBounds = (par.freeBounds | point.ngIneg2<rho*point.ngred2);
% find appropriate free variables
if par.freeBounds
% identify I = {i | l(i)<x(i)<u(i) or gred(i)=~0}
point.actl=find(point.x==point.low);
point.actu=find(point.x==point.upp);
point.Ipos=union(find(point.gred),...
setdiff(1:point.n,union(point.actl,point.actu)));
point.nIpos=length(point.Ipos);
if info.ng==1 | point.nIpos>point.nIneg,
% freeing step
point.Ineg=point.Ipos; par.nlocal=0;
if info.prt>=1,
disp(' '); disp('findFreePos: freeing step'); disp(' ');
end
end;
end; % if freeBounds
% update free index set
point.I = point.Ineg;
point.nI = length(point.I);
info.nI = point.nI;
point.gI = point.g(point.I);
point.omega = point.gI'*point.gI;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%