Currently, the optimisation loop is set to run for a set length of time.
Implement the option to choose a combination of stopping criteria including (but not necessarily limited to) the following:
- Max iterations
- Sufficient value of loss function on last iteration
- Sufficiently low gradient of loss function wrt recent iterations