optimization of lagoon operation