findit (lims = list(), objective = "CV", niter = NULL, iprotein = NULL, plot.it = TRUE, T = 25, P = "Psat", res = NULL, labcex = 0.6, loga2 = NULL, loga.balance = 0, rat = NULL, balance = NULL, normalize = FALSE) plot_findit(x, which=NULL, mar=c(3.5,5,2,2), xlab="iteration", ...)
diagram
)diagram
)diagram
)findit
plot
findit
returns a list having class findit
with elements value
(values of the parameters, and value of the objective function, at each iteration), lolim
(lower limits of the parameters) and hilim
(upper limits of the parameters).
findit
implements a gridded optimization to find the minimum or maximum value of an objective
function.
The variables are one or more of the chemical activities, temperature and/or pressure whose ranges are listed in lims
.
Generally, the system (basis
species and species
of interest) must be set up before calling this function.
If iprotein
is supplied, indicating a set of proteins to use in the calculation, the definition of the species
is not required.
lims
is a list, each element of which is vector having a name that is the formula of one of the basis species, T or P and a pair of values indicating the range of the named parameter.
The values are the logarithms of activities of the basis species, or temperature or pressure (in the user's units; see util.units
).
If either T or P is missing from the list in lims
, the calculations are performed at isothermal and/or isobaric conditions indicated by T
and P
arguments.Taking $nd$ as the number of dimensions (number of variables in lims
), default values of niter
and res
come from the following table.
These settings have been selected to be able to run the function quickly in the higher dimensions.
Detailed studies of a system might have to use more iterations and/or higher resolutions.
nd |
niter |
res |
grid points (res^nd ) |
rat |
1 | 4 | 128 |
128 | 0.7 | 2 | 6 |
64 | 4096 | 0.7 | 3 |
6 | 16 | 4096 | 0.8 |
4 | 8 | 8 | 4096 |
0.9 | 5 | 12 | 6 |
7776 | 0.9 | 6 | 12 |
4 | 4096 | 0.95 | 7 |
12 | 4 | 16384 | 0.95 |
The function performs niter
iterations. At first, the limits of the parameters given in lims
define the extent of a $nd$-dimensional box around the space of interest. The value of objective
is calculated at each of the $res^nd$ grid points and and optimum value located (see revisit
and optimal.index
). In the next iteration the new search box is centered on the location of the optimum value, and the edges are shrunk so their length is rat
* the length in the previous step. If the limits of any of the parameters extend beyond those in lims
, they are pushed in to fit (preserving the difference between them).
plot_findit
plots the values of the parameters and the objective function as a function of the number of iterations.
demo("findit")
and tests/test-findit.R
for examples.