L-BFGS-B  3.0
Large-scale Bound-constrained Optimization
freev.f
Go to the documentation of this file.
1 c> \file freev.f
2 
3 c> \brief This subroutine counts the entering and leaving variables when
4 c> iter > 0, and finds the index set of free and active variables
5 c> at the GCP.
6 c>
7 c> This subroutine counts the entering and leaving variables when
8 c> iter > 0, and finds the index set of free and active variables
9 c> at the GCP.
10 c>
11 c> @param n number of parameters
12 c> @param nfree number of free parameters, i.e., those not at their bounds
13 c> @param index for i=1,...,nfree, index(i) are the indices of free variables<br/>
14 c> for i=nfree+1,...,n, index(i) are the indices of bound variables<br/>
15 c> On entry after the first iteration, index gives
16 c> the free variables at the previous iteration.<br/>
17 c> On exit it gives the free variables based on the determination
18 c> in cauchy using the array iwhere.
19 c> @param nenter TODO
20 c> @param ileave TODO
21 c> @param indx2 On entry indx2 is unspecified.<br/>
22 c> On exit with iter>0, indx2 indicates which variables
23 c> have changed status since the previous iteration.<br/>
24 c> For i= 1,...,nenter, indx2(i) have changed from bound to free.<br/>
25 c> For i= ileave+1,...,n, indx2(i) have changed from free to bound.<br/>
26 c> @param iwhere TODO
27 c> @param wrk TODO
28 c> @param updatd TODO
29 c> @param cnstnd indicating whether bounds are present
30 c> @param iprint control screen output
31 c> @param iter TODO
32  subroutine freev(n, nfree, index, nenter, ileave, indx2,
33  + iwhere, wrk, updatd, cnstnd, iprint, iter)
34 
35  integer n, nfree, nenter, ileave, iprint, iter,
36  + index(n), indx2(n), iwhere(n)
37  logical wrk, updatd, cnstnd
38 c
39 c * * *
40 c
41 c NEOS, November 1994. (Latest revision June 1996.)
42 c Optimization Technology Center.
43 c Argonne National Laboratory and Northwestern University.
44 c Written by
45 c Ciyou Zhu
46 c in collaboration with R.H. Byrd, P. Lu-Chen and J. Nocedal.
47 c
48 c
49 c ************
50 
51  integer iact,i,k
52 
53  nenter = 0
54  ileave = n + 1
55  if (iter .gt. 0 .and. cnstnd) then
56 c count the entering and leaving variables.
57  do 20 i = 1, nfree
58  k = index(i)
59 
60 c write(6,*) ' k = index(i) ', k
61 c write(6,*) ' index = ', i
62 
63  if (iwhere(k) .gt. 0) then
64  ileave = ileave - 1
65  indx2(ileave) = k
66  if (iprint .ge. 100) write (6,*)
67  + 'Variable ',k,' leaves the set of free variables'
68  endif
69  20 continue
70  do 22 i = 1 + nfree, n
71  k = index(i)
72  if (iwhere(k) .le. 0) then
73  nenter = nenter + 1
74  indx2(nenter) = k
75  if (iprint .ge. 100) write (6,*)
76  + 'Variable ',k,' enters the set of free variables'
77  endif
78  22 continue
79  if (iprint .ge. 99) write (6,*)
80  + n+1-ileave,' variables leave; ',nenter,' variables enter'
81  endif
82  wrk = (ileave .lt. n+1) .or. (nenter .gt. 0) .or. updatd
83 
84 c Find the index set of free and active variables at the GCP.
85 
86  nfree = 0
87  iact = n + 1
88  do 24 i = 1, n
89  if (iwhere(i) .le. 0) then
90  nfree = nfree + 1
91  index(nfree) = i
92  else
93  iact = iact - 1
94  index(iact) = i
95  endif
96  24 continue
97  if (iprint .ge. 99) write (6,*)
98  + nfree,' variables are free at GCP ',iter + 1
99 
100  return
101 
102  end
subroutine freev(n, nfree, index, nenter, ileave, indx2, iwhere, wrk, updatd, cnstnd, iprint, iter)
This subroutine counts the entering and leaving variables when iter > 0, and finds the index set of f...
Definition: freev.f:34