A Practical Algorithm for Multiple-Phase Control Systems in Agricultural and Natural Resource Economics