Learn R Programming

soobench (version 1.9.18)

counting_function: Count number of function evaluations

Description

Return a new function which is identical to the soo_function passed in except that all function evaluations are counted.

Usage

counting_function(fn)

Arguments

fn

[soo_function] A test function.

See Also

number_of_evaluations, reset_evaluation_counter

Examples

Run this code
# NOT RUN {
f <- counting_function(generate_double_sum_function(5))
number_of_evaluations(f)

y <- f(random_parameters(1, f))
number_of_evaluations(f)

reset_evaluation_counter(f)
number_of_evaluations(f)

y <- f(random_parameters(21, f))
number_of_evaluations(f)

# }

Run the code above in your browser using DataLab