findit {CHNOSZ}R Documentation

Gridded Search to Optimize Objective Functions

Description

Use a gridded search to find a combination of one or more of chemical activities of basis species, temperature and/or pressure that maximize or minimize a objective function of the metastable equilibrium chemical activities of the species of interest.

Usage

  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", ...)

Arguments

lims

list, specification of search limits

objective

character, name of objective function to optimize

niter

numeric, number of iterations

res

numeric, grid resolution (number of points on one edge)

iprotein

numeric, indices of proteins

plot.it

logical, make a plot?

T

numeric, temperature

P

numeric, pressure; or character, "Psat"

labcex

numeric, character expansion for plot labels

loga2

numeric, reference logarithms of activity of species

loga.balance

numeric, logarithm of total activity of balanced quantity (passed to diagram)

rat

numeric, ratio of edge length in successive iterations

balance

character or numeric, balanced quantity (passed to diagram)

normalize

logical, normalize chemical formulas by the balance vector? (passed to diagram)

x

list, object of class findit

which

numeric, which of the parameters to plot

mar

numeric, plot margin specification

xlab

character, x-axis label

...

additional arguments passed to plot

Details

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). 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.

Value

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).

See Also

demo("findit") and test-findit.R for examples.


[Package CHNOSZ version 1.4.3 Index]