A hierarchical approach to sustainable agriculture