In test_threads() we replace either MAXEVAL or NITER with whatever is passed through .max_eval. A few things to consider, that aren't currently accounted for in the code:
When NITER is found, we also need to replace/set NBURN to the same number.
In some cases, users don't have to specify some of these in their control stream, instead falling back to a default. We need to look into the NONMEM docs to understand the following:
does the user always have to specify eitherMAXEVAL or NITER, or can they specify neither and let NONMEM use a default based on the estimation method? If the latter, we will need to have the code logic look at the estimation method and infer which needs to be set (assuming one isn't set in the control stream).
for estimation methods using NITER, is NBURN always relevant (i.e. do we always want to set it, or are there estimation methods that use NITER but notNBURN? I don't think so, but let's make sure.)
We may want to move all of this parsing logic to its own private helper function, because it's likely to get a bit complicated.
pseudo-code for conditional logic
#### will need to loop over and do this for _each_ estimation method found in the control stream
ctl_lines <- read_lines(control_stream_file)
if (str_detect("MAXEVAL", ctl_lines)) {
# replace MAXEVAL with .max_eval
} else if (str_detect("NITER", ctl_lines)) {
# replace NITER with .max_eval
if (str_detect("NBURN", ctl_lines) {
# replace NBURN with .max_eval
} else {
# add NBURN=.max_eval
}
} else { # if neither are found (we _think_ we need this, but not sure)
# check estimation method and figure out whether
# to add MAXEVAL=.max_eval or
# NITER=.max_eval and NBURN=.max_eval
}
In
test_threads()
we replace eitherMAXEVAL
orNITER
with whatever is passed through.max_eval
. A few things to consider, that aren't currently accounted for in the code:NITER
is found, we also need to replace/setNBURN
to the same number.MAXEVAL
orNITER
, or can they specify neither and let NONMEM use a default based on the estimation method? If the latter, we will need to have the code logic look at the estimation method and infer which needs to be set (assuming one isn't set in the control stream).NITER
, isNBURN
always relevant (i.e. do we always want to set it, or are there estimation methods that useNITER
but notNBURN
? I don't think so, but let's make sure.)pseudo-code for conditional logic