#' @title Factory method for monitor objects.
#'
#' @param before [\code{function}]\cr
#' Function called one time after initialization of the EA.
#' @param step [\code{function}]\cr
#' Function applied after each iteration of the algorithm.
#' @param after [\code{function}]\cr
#' Function applied after the EA terminated.
#' @param ... [\code{any}]\cr
#' Not used.
#' @return [\code{AntsMonitor}]
#' Monitor object.
#'
#' @export
# nocov start
makeMonitor = function(before = NULL, step = NULL, after = NULL, ...) {
if (!is.null(before)) assertFunction(before)
if (!is.null(step)) assertFunction(step)
if (!is.null(after)) assertFunction(after)
dummy = function(...) {}
structure(
list(
before = coalesce(before, dummy),
step = coalesce(step, dummy),
after = coalesce(after, dummy)
),
class = "AntsMonitor")
}
# nocov end
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.