Optimization of biological processes: A new numerical method applied to biomedical systems