Dynamic Models for Exploring the Resilience in Territorial Scenarios