Given a set of \(n\) algorithms \(A\) (parameter A) with parameters \(\theta_i, i \in A\) (parameter A.pars) the goal is to produce a function f = function(x, ...) that expects a problem instance x and optional arguments .... The function shall run each algorithm \(A_i \in A\) parameterized with \(\theta_i\) on x. In case of stochastic/randomized algorithms each algorithm should be run multiple times (parameter repls) returning an aggregated value (parameter aggr.fun).

make_runner_function(
  A,
  A.pars,
  runner.fun,
  repls = 1L,
  aggr.fun = base::mean,
  named.result = TRUE
)

Arguments

A

[character]
Character vector of at least two algorithm names. Note that the names must be valid arguments for the “algorithm” parameter of parameter runner.fun.

A.pars

[list of lists]
A named list (names equal to A) where each sub-list should contain parameters for the respective algorithm.

runner.fun

[function(x, algorithm, ...)]
A function that expects an instance x, an algorithm name algorithm (see parameter A) and optional further parameters (see parameter A.pars).

repls

[integer]
How many independent runs should be conducted for each algorithm on an instance? Defaults to 1, but should be adjusted if the corresponding algorithm(s) is/are of stochastic nature. If a single value is passed it is used for all algorithms.

aggr.fun

[function(x, ...)]
Function used to aggregate results of multiple runs. Only applied if repls[i] is greater than one for algorithm A[i]. Defaults to mean.

named.result

[logical(1)]
Should the result vector be named with A? Default is TRUE.

Value

[function(x, ...)] Factorized function (see description).