with_fixed_budget: Fixed budget expression evaluation Evaluate 'expr' with a...

Description Usage Arguments Details Value Examples

View source: R/with_fixed_budget.R

Description

Fixed budget expression evaluation

Evaluate expr with a fixed budget for the number of times any test function in expr may be evaluated.

Usage

1
with_fixed_budget(expr, budget)

Arguments

expr

[expression]
Expression to evaluate

budget

[integer(1)]
Maximum number of test function evaluations that may be performed by expr.

Details

The main use of this function is in benchmarking (optimization) algorithms. It ensures that the algorithm does not perform more than budget function evaluations by tracking the number of evaluations performed and raising a condition if the budget is reached. For this to work, the function must find one and only one soofunction object in expr which will be replaced by a modified test function that performs the tracking and signaling.

While elegant from a users perspective, this function is not fool proof. It is possible to construct situations were it will fail. For example, if the employed optimization algorithm is written in C and does not use the memory allocation routines provided by R, then this will certainly lead to memory leaks. You have been warned.

Value

A list with elements ‘par’, ‘value’ and ‘counts’ with contents that are identical to the return value of optim

Examples

1
2
3

soobench documentation built on Feb. 9, 2020, 5:08 p.m.