Create a custom stopping criterion.
