This function creates a flow stopper object that calculate metrics, at each iteration, based on the current results of the algorithm, and checks if the algorithm should stop based on those metrics.
Given the objects in \(R\) (list of results for every iteration), the user can define a set of metrics \(M_t\), to be calculated at every iteration \(t\). Based on each metric\(m\), a stopping criterion can be defined via any expression on \(m\) that returns a boolean.
Finally, the list of booleans for a given iteration \(t\) can be combined with any logic expression to determine if the algorithm should stop.
Arguments
- formulas
A list of formulas specifying the metrics \(m\) to be calculated on the LHS (see details), and the stopping criterion depending on the metric value
.m
, on the RHS.- check_expr
A RHS-only formula with a logic operation, depending on the vector of booleans
.ms
.- iter_upper
A technical argument used to initialize containers for \(R\) and \(M\). A stopping criterion based on \(t\) should be defined in the
formulas
argument.
Value
A "flow_stopper"
-class object to be passed to optimize_phy()
.
Details
The LHS of the are evaluated in the context of the algorithm, i.e., it can
depend on the variables t
(current iteration), time
(current time in
seconds), and the list of each element in \(R\) (with length t
).
For example, f[[t - 1]]
will evaluate to the vector of objective function
values of all the samples in the previous iteration.
Note that you can set unfeasible stopping criteria, FALSE
to only get
the value of the metric at the end of the algorithm.