Optimal ecosystem management using networked theory and optimization