Skip to contents

Define the objective function of a compartmental model in TMB.

Usage

ObjectiveFunction(obj_fn_expr)

Arguments

obj_fn_expr

One sided formula giving the objective function of a TMB model. The right hand side expression must contain only the names of matrices in the model, functions defined in macpan2.cpp, and numerical literals (e.g. 3.14).

Value

Object of class ObjectiveFunction with the following methods.

Methods

  • data_arg(..., .existing_literals) -- Return the following components of the data structure to pass to C++.

    • o_table_x -- Objective function parse table column giving an index for looking up either function, matrix, or literal.

    • o_table_n -- Objective function parse table column giving the number of arguments in functions.

    • o_table_i -- Objective function parse table column giving indices for looking up the rows in the parse table corresponding with the first argument of the function.

    • literals -- Numeric vector of literals that can were used in the expressions of the model.

Method Arguments

  • ...: Character vector containing the names of the matrices in the model.

  • .existing_literals: Numeric vector giving the literals used in the model expressions produced before the objective function.