```
From: musor000@optonline.net
Subject: [NMusers] Can we increase maximum number of function evaluations?
Date: Sun, 27 Aug 2006 13:39:11 -0400

Hello Nonmem Users,

I have a problem, which converges slowly.   Is that possible to increase maximum number of function evaluations?

Thank you,
Pavel

_______________________________________________________

From: Mark Sale - Next Level Solutions mark@nextlevelsolns.com
Subject: RE: [NMusers] Can we increase maximum number of function evaluations?
Date: Sun, 27 Aug 2006 13:36:30 -0700

Sure, easy, put this code at the top of the \$PK block:

"   FIRST
"   COMMON /PRCOMG/ IDUM1,IDUM2,IMAX
"   INTEGER IDUM1,IDUM2,IMAX
"   IMAX=10000000

but, also consider if your DE system is "stiff" - meaning that the rate
of change of the slowest compartment is much, much slower than the
fastest (i.e., KA is 10 and Ke is 0.001).  Might consider trying ADVAN8
or ADVAN9 - which do much better for stiff systems.

Mark Sale MD
Next Level Solutions, LLC
www.NextLevelSolns.com

_______________________________________________________

From: Nick Holford n.holford@auckland.ac.nz
Subject: RE: [NMusers] Can we increase maximum number of function evaluations?
Date: Mon, 28 Aug 2006 10:08:46 +1200

Hi,

Pavel is rather vague about the problem he is having and why he is
interested in changing function evaluations.

It seems there are two issues here:

First, in NONMEM speak the number of function evaluations usually means the
number of objective function evaluations. It is controlled by the \$ESTIMATION
option MAXEVALS. The maximum possible is MAXEVALS=9999. This can be used to
limit the amount of work that NONMEM does when searching for parameters.
Typically one uses either MAXEVALS=9999 or MAXEVALS=0. I dont have much
use for other values.

MAXEVALS=n2
Maximum allowable number of evaluations of the objective function
during  the  Estimation Step.  Default: a generous number.  (Each
evaluation of the objective function requires  one  pass  through
the  data  set.)  This is also referred to as a "function evalua-
tion.") MAXEVAL=0 omits the Estimation Step; it  is  useful  with
POSTHOC.   MAXEVALS=-1  may  be  specified when a \$MSFI record is
present.  It requests that NONMEM re-use the value from the  pre-
vious run, and is the default with \$MSFI.

Second, Mark has shown some verbatim code for increasing the number of differential
equation evaluations used by the differential equation solver. This has little to
do with the job that NONMEM is doing i.e. estimating the model parameters, but has
to do with the work required to solve the differential equations. Mark gives an
example for increasing the rather small number of DE evaluations that is supplied
by default.

The online help indicates the verbatim option FIRST should start immediately after the ".

FIRST verbatim code
Verbatim lines which must be  positioned  immediately  after  the
declarations  which are part of the normal subroutine header, and
prior to the FIRST executable statement of the  subroutine,  must
the line "FIRST.

I am not sure if it makes any difference to do it the way that Mark wrote it.

However, it is essential to have at least one blank between " and COMMON. If not then NM-TRAN will
treat this record as a Fortran comment statement.

Nick
--
Nick Holford, Dept Pharmacology & Clinical Pharmacology
University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand
email:n.holford@auckland.ac.nz tel:+64(9)373-7599x86730 fax:373-7556
http://www.health.auckland.ac.nz/pharmacology/staff/nholford/
_______________________________________________________

From: "Bill Bachman" bachmanw@comcast.net
Subject: RE: [NMusers] Can we increase maximum number of function evaluations?
Date: Sun, 27 Aug 2006 19:31:50 -0400

There are legitimate uses for other than values of 0 or 9999.  For example,
with long slow runs using differential equations, one might want to do a
preliminary timing experiment with maxeval=10 or 100 with ADVANs 6, 8, & 9
to determine which advan is fastest.  You could then use the fastest advan
(for the particular problem) to do the complete run(s).
_______________________________________________________

From: Mark Sale - Next Level Solutions mark@nextlevelsolns.com
Subject: RE: [NMusers] Can we increase maximum number of function evaluations?
Date: Sun, 27 Aug 2006 17:27:26 -0700

I see that I misread the question - it wasn't about iterations.  The
only way I'm aware of to increase the nunber of function evaluations is
to run 9999, save to a MSF, use that as the initial for the next and run
another 9999. I'm pretty sure this can be done in the same run, using
multiple problems.  Interestingly, the only reason, that I'm aware of
for this limit is the only 4 spaces are available for this number in
the FCON file.  NONMEM itself has no such limit (possibly a INTEGER
type, limit of 32,000)

Mark Sale MD
Next Level Solutions, LLC
www.NextLevelSolns.com
_______________________________________________________

From: musor000@optonline.net
Subject: RE: [NMusers] Can we increase maximum number of function evaluations?
Date: Wed, 30 Aug 2006 15:32:57 -0400

Hello Nick,
I am getting strange results.  When I use \$EST .... MSFO=MSF44.MSF in a job which ends
quickly, the output MSF file is created.  When I run a job which is interrupted due
to large number of function evaluations, the output MSF file is not created.

Thank you,
Pavel
_______________________________________________________
```