Skip to contents

This function is useful for testing or debugging the behavior of optimization functions. It can throw a warning and / or an error on purpose.

Usage

test_optimizer(
  objective = test_objective,
  initial = 1,
  ...,
  parameter = 1,
  value = objective(parameter),
  seconds = 0,
  warning_prob = 0,
  error_prob = 0,
  warning_msg = "warning",
  error_msg = "error",
  call. = TRUE
)

Arguments

objective

An objective function.

initial

The initial parameter vector.

...

Optionally additional arguments to be passed to objective.

parameter

Defines the output parameter.

value

Defines the output value.

seconds

A delay in number of seconds.

warning_prob

The probability for throwing a warning.

error_prob

The probability for throwing an error.

warning_msg

The warning message.

error_msg

The error message.

call.

Passed to warning or stop, respectively.

Value

A list with elements parameter and value.