Today, we’ll dive into an important real-world problem: prioritizing infrastructure recovery after a disaster.
When natural disasters strike, decision-makers must determine the optimal sequence for restoring critical services with limited resources.
Let’s explore this challenge using Python optimization techniques.
The Problem: Post-Disaster Recovery Prioritization
Imagine a scenario where a major hurricane has damaged multiple infrastructure systems in a coastal city.
We need to schedule repairs to maximize the restored population service while considering:
- Limited repair crews/resources
- Different repair times for each facility
- Varying population impacts
- Dependencies between infrastructure systems
Mathematical Formulation
We can formulate this as an optimization problem.
Let’s define:
- $i$ = infrastructure facility index
- $p_i$ = population served by facility $i$
- $t_i$ = time required to repair facility $i$
- $d_{ij}$ = dependency (1 if facility $i$ depends on facility $j$, 0 otherwise)
- $x_i$ = repair start time for facility $i$
- $C_i$ = completion time for facility $i$ (equals $x_i + t_i$)
Our objective is to minimize the total population-hours without service:
$$\min \sum_{i} p_i \cdot C_i$$
Subject to constraints:
- Resource constraints (limited repair crews)
- Dependency constraints (some facilities must be repaired before others)
- Non-negative start times
Let’s implement this using Python and solve it with PuLP, a popular linear programming library.
1 | import numpy as np |
Understanding the Code
Let’s break down the key components of our solution:
1. Problem Definition
We’ve created a scenario with 8 critical infrastructure facilities: Power Plant, Water Treatment, Hospital, Cell Tower, Bridge, Shelter, Grocery Store, and Gas Station. Each has:
- A repair time (days required to complete repairs)
- Population impact (thousands of people affected)
- Dependencies (which facilities must be operational first)
2. Mathematical Model Implementation
The code uses PuLP, a linear programming library, to model this optimization problem:
Decision Variables:
- When to start repairing each facility
- Binary variables for crew assignments
Objective Function:
Minimize total population-days without service (population × time without service)Constraints:
- Resource constraints: Limited to 3 repair crews
- Dependency constraints: Some facilities require others to be operational first
- Assignment constraints: Each facility must be repaired exactly once
3. Visualization
The code generates four visualizations to help understand the solution:
- Gantt Chart: Shows the repair schedule with start and end times

- Dependency Graph: Visualizes the relationships between facilities

- Crew Assignment Chart: Shows which crew is assigned to each facility

- Restoration Timeline: Tracks cumulative population service restoration

Results Analysis
The optimization model provides a clear schedule prioritizing infrastructure repairs to minimize the total impact on the population.
Key Insights
- Critical Path: The Power Plant is repaired first as many other facilities depend on it
- Resource Allocation: The 3 repair crews are allocated efficiently to avoid idle time
- Impact-driven: Facilities serving larger populations are generally prioritized
- Dependency Management: The solution respects all technical dependencies
Restoration Timeline
The cumulative service restoration graph shows how quickly we can restore services to the affected population.
With our optimized schedule:
- 50% of service is restored within the first week
- Nearly complete restoration occurs by day 12
- The critical first 3-4 days focus on the most impactful infrastructure
Practical Applications
This type of optimization can be applied to various disaster recovery scenarios:
- Hurricane/flood recovery operations
- Earthquake response
- Power grid restoration after major outages
- Pandemic response for healthcare infrastructure
Decision-makers can use this approach to:
- Develop pre-disaster recovery plans
- Adapt to changing conditions during a crisis
- Justify resource allocation decisions
- Communicate expectations to affected populations
Conclusion
Infrastructure recovery scheduling is a complex optimization problem with real-world impact.
By formulating it mathematically and leveraging Python’s optimization libraries, we can create decision support tools that help communities recover faster from disasters.
The approach demonstrated here balances population needs, technical constraints, and limited resources to minimize the overall impact of infrastructure disruptions.
Similar techniques can be applied to many other resource allocation and scheduling problems in emergency management.













