Some non-linear optimisation routines.