Method new()
Creates a new Objective
object.
Usage
Objective$new(f, target = NULL, npar, ...)
Arguments
f
A function
to be optimized.
It is expected that f
has at least one numeric
argument.
Further, it is expected that the return value of f
is of the
structure numeric(1)
, i.e. a single numeric
value (although
this can be altered via the output_template
field).
target
A character
, the argument name(s) of f
that get optimized.
All target arguments must receive a numeric
vector
.
Can be NULL
(default), then it is the first argument of f
.
npar
A integer
of the same length as target
, defining the length
of the respective numeric
vector
argument.
...
Optionally additional arguments to f
that are fixed during
the optimization.
Returns
A new Objective
object.
Method set_argument()
Set a fixed function argument.
Usage
Objective$set_argument(..., overwrite = TRUE, verbose = self$verbose)
Arguments
...
Optionally additional arguments to f
that are fixed during
the optimization.
overwrite
Either TRUE
(default) to allow overwriting, or FALSE
if not.
verbose
Either TRUE
(default) to print status messages, or FALSE
to hide those.
Returns
Invisibly the Objective
object.
Method get_argument()
Get a fixed function argument.
Usage
Objective$get_argument(argument_name, verbose = self$verbose)
Arguments
argument_name
A character
, a name of an argument for f
.
verbose
Either TRUE
(default) to print status messages, or FALSE
to hide those.
Returns
The argument value.
Method remove_argument()
Remove a fixed function argument.
Usage
Objective$remove_argument(argument_name, verbose = self$verbose)
Arguments
argument_name
A character
, a name of an argument for f
.
verbose
Either TRUE
(default) to print status messages, or FALSE
to hide those.
Returns
Invisibly the Objective
object.
Method validate()
Validate an Objective
object.
Usage
Objective$validate(.at)
Arguments
.at
A numeric
of length sum(self$npar)
, the values for the target
arguments written in a single vector.
Returns
Invisibly the Objective
object.
Method evaluate()
Evaluate the objective function.
Usage
Objective$evaluate(.at, .negate = FALSE, ...)
Arguments
.at
A numeric
of length sum(self$npar)
, the values for the target
arguments written in a single vector.
.negate
Either TRUE
to negate the numeric
return value of
f
, or FALSE
(default) else.
...
Optionally additional arguments to f
that are fixed during
the optimization.
Returns
The objective value.
Print details of the Objective
object.
Returns
Invisibly the Objective
object.
Method clone()
The objects of this class are cloneable with this method.
Usage
Objective$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.