Skip to contents

Shootout(prob, setups) solves the problem with each setup and compares the efficiencies \(1 / (error \cdot time)\) (the error error_estimate against the analytic solution or appxsol, the time the best of numruns runs). effratios[i, j] is the efficiency of i relative to j, and winner the name of the most efficient setup. ShootoutSet(probs, setups) runs a shootout for each problem of a list (with the options of probaux[[i]] for problem i).

Usage

Shootout(prob, setups, ..., p = NULL)

ShootoutSet(probs, setups, ..., p = NULL)

# S3 method for class 'Shootout'
plot(x, xlab = "Algorithms", ylab = "Efficiency", ...)

Arguments

prob

A problem.

setups

List of setups.

...

Options: appxsol, names, error_estimate (default "final"), numruns (default 20), seconds (default 2) and solver options; for ShootoutSet() also probaux and print_names.

p

The solver option p, named in the signature so that it does not partially match prob or probs.

probs

A list of problems.

x

A Shootout.

xlab, ylab

Axis labels.

Value

A Shootout (a list with setups, times, errors, effs, effratios, solutions, names, N, bestidx and winner) or a ShootoutSet (with shootouts, probs, probaux, N and winners).

Examples

fn <- ODEFunction(function(u, p, t) -u, analytic = function(u0, p, t) u0 * exp(-t))
prob <- ODEProblem(fn, 1, c(0, 1))
sh <- Shootout(prob, list(list(alg = Euler()), list(alg = RK4())), dt = 1 / 16, numruns = 1)
sh$errors
#> [1] 1.180531e-02 3.348242e-06