Algorithms And Metrics For Territorial Design