Optimal decision making to control ecological systems