Skip to content

mikabba/evacuation-parallel-pso-simevents

Repository files navigation

Dynamic Evacuation Control with Parallel Particle Swarm Optimization

MATLAB Simulink SimEvents Optimization Parallel Computing Domain Status

MATLAB/Simulink project for dynamic evacuation routing in emergency conditions using Particle Swarm Optimization (PSO) and Parallel Particle Swarm Optimization (PPSO).

The project models the evacuation of people from a building as a discrete-event queueing network implemented with SimEvents. The optimizer acts on routing probabilities that determine how pedestrian entities are distributed among alternative paths. The objective is to minimize the total evacuation time while accounting for congestion, queue dynamics, bottlenecks, route switching and possible changes in path availability.

Case-study corridor decomposition

Figure 1. Case-study layout decomposed into queueing-network blocks.


1. Problem statement

Emergency evacuation is affected by uncertain crowd distributions, bottlenecks, blocked routes, local congestion and behavioral effects. Static evacuation plans are limited because they do not react to the current state of the evacuation process.

This project investigates a dynamic control strategy in which routing decisions are periodically optimized using the current simulation state. The evacuation model provides the performance feedback, while PSO and PPSO search for the routing probabilities that reduce evacuation time.

The optimization problem is formulated as:

$$\min_x J(x)$$

where:

  • x is the vector of routing decision variables;
  • J(x) is the evacuation-time objective returned by the SimEvents model;
  • each decision variable is normalized in the interval [0, 1];
  • the repository implementation uses a 24-variable decision vector.

2. Engineering objective

The engineering goal is to evaluate whether parallel metaheuristic optimization can support evacuation control under dynamic emergency conditions.

The project compares three evacuation strategies:

Strategy Description
No optimization Fixed transition probabilities are used throughout the evacuation.
Single optimization PSO/PPSO computes a routing policy once, before running the evacuation.
Periodic optimization The evacuation is paused periodically, the current state is read, and routing probabilities are re-optimized.

The periodic strategy is the most reactive one because it updates routing decisions during the evolution of the evacuation.


3. Evacuation model

The building is represented as a network of queueing components. Each building element is modeled as a SimEvents subsystem that processes pedestrian entities.

Main components:

Component Modeling role
Room / source Generates pedestrian entities.
Corridor Processes pedestrians with capacity and traversal-time constraints.
Stairs Models slower traversal dynamics due to stair motion.
Door / exit Represents bottlenecks, queues and limited discharge flow.
Queue-switching block Routes entities toward alternative paths according to decision probabilities.
Terminator / exit counter Counts evacuated entities and supports stop conditions.

Complete SimEvents evacuation model

Figure 2. Complete SimEvents model of the case study.


4. Case study

The case study consists of a room-like evacuation area with two parallel corridors and two exits. The area is decomposed into six corridor blocks and two exit regions.

Evacuation case-study layout

The upper corridor is split into four blocks, while the lower corridor is split into two blocks. Exit 1 is reachable through the right-side blocks, and Exit 2 is reachable through the left-side blocks. This decomposition makes it possible to define local routing choices and evaluate how congestion changes over time.


5. Discrete-event queueing formulation

The evacuation dynamics are modeled as a discrete-event system. Each pedestrian is represented as an entity, and each structural element of the building acts as a queueing or service subsystem.

Queueing network abstraction

The queueing abstraction is useful because it captures:

  • finite-capacity corridors;
  • waiting effects near doors and exits;
  • service times for crossing building elements;
  • state-dependent congestion;
  • throughput and utilization metrics.

6. Bottleneck behavior

Doors and narrow passages are modeled as bottlenecks. Under high demand, increasing the desired flow can reduce the actual discharge rate because of crowd pressure and local obstruction. This effect is commonly known as faster-is-slower.

Faster-is-slower effect at bottlenecks

This effect is relevant for evacuation control because the optimal policy is not necessarily the one that sends the largest number of people to the shortest path. A route can become inefficient when it becomes saturated.


7. Optimization workflow

The optimizer searches for the routing probabilities that minimize evacuation time.

Workflow:

  1. initialize model constants and PSO parameters;
  2. generate a candidate vector of routing probabilities;
  3. pass the candidate policy to the SimEvents evacuation model;
  4. simulate the evacuation behavior;
  5. compute the fitness value from evacuation time;
  6. update particle positions and velocities;
  7. repeat until the stopping condition is reached.

The fitness function is exposed in MATLAB through:

CostFunction = @(x) calcoloFitness(x);

The sequential optimizer is executed with:

out = PSO(problem, params);

The parallel optimizer is executed with:

out = parallelPSO(problem, params, step);

8. PSO and PPSO implementation

Sequential PSO

The sequential implementation evaluates the particles one after another. For each candidate solution, the SimEvents model is simulated and the resulting evacuation time is used as the fitness value.

Parallel PSO

The PPSO implementation distributes particle updates and fitness evaluations across a local pool of MATLAB workers. The model constants are copied to the workers before the parallel computation. Group-level best solutions are computed first and then reduced to obtain the global best solution.

This structure reduces execution time when the number of particles increases, because multiple simulation-based fitness evaluations can be executed concurrently.


9. Experimental setup

PPSO experiments were performed on three population scenarios:

Scenario People to evacuate Notes
Small scenario 72 Lower congestion level
Medium scenario 120 Intermediate congestion level
Large scenario 300 Stronger congestion and longer evacuation time

PPSO configuration used in the reported experiments:

Parameter Value
Maximum iterations 10
Number of particles 30
Decision variables 24
Variable bounds [0, 1]
Fitness objective Total evacuation time

10. Results

The results show that PPSO reduces the computational burden of the optimization phase compared with sequential PSO, especially as the number of particles increases.

PSO and PPSO execution time comparison

Figure 3. Sequential PSO and parallel PPSO single-iteration execution time comparison.

Evacuation-time comparison

The following table reports the average evacuation time over ten simulations for three strategies.

Scenario No optimization Single optimization Periodic optimization
72 people 1147.3 s 586.07 s 385.75 s
120 people 1471.7 s 676.68 s 498.69 s
300 people 3973.3 s 1493.4 s 1016.5 s

Evacuation time comparison

Periodic optimization provides the best evacuation performance in all scenarios. Relative to the non-optimized evacuation, the average evacuation-time reduction is approximately:

Scenario Reduction with periodic optimization
72 people 66.38%
120 people 66.11%
300 people 74.42%

Throughput comparison

Scenario No optimization Single optimization Periodic optimization
72 people 0.0628 0.1228 0.1866
120 people 0.0815 0.1773 0.2406
300 people 0.0755 0.2009 0.2951

Throughput comparison

The throughput results confirm that periodic re-optimization improves the effective evacuation rate, particularly in the highest-density scenario.


11. PPSO convergence examples

The optimizer reaches improved evacuation-time values within a small number of iterations.

PPSO convergence for 72 people

Figure 4. PPSO best-cost evolution for the 72-person scenario.

Additional convergence plots are available in the results/ folder for the 120-person and 300-person scenarios.


12. Repository structure

evacuation-parallel-pso-simevents/
├── assets/
│   ├── case_study_layout.png
│   ├── case_study_blocks.png
│   ├── simevents_case_study_model.png
│   ├── queueing_network_model.png
│   ├── faster_is_slower.png
│   ├── corridor_simevents_block.png
│   ├── door_simevents_block.png
│   └── queue_switch_simevents_block.png
├── results/
│   ├── pso_ppso_initialization_time.png
│   ├── pso_ppso_iteration_time.png
│   ├── ppso_convergence_72_people.png
│   ├── ppso_convergence_120_people.png
│   ├── ppso_convergence_300_people.png
│   ├── evacuated_people_72_ppso.png
│   ├── evacuated_people_120_ppso.png
│   ├── evacuated_people_300_ppso.png
│   ├── evacuation_time_comparison.csv
│   ├── throughput_comparison.csv
│   └── results_summary.md
├── building-elementary-blocks/
│   └── DesignPattern.slx
├── funzioni/
├── inizializzazioni/
├── Completo_direzioniDinamiche.slx
├── mainPSO.m
├── mainPPSO.m
├── README.md
└── .gitignore

Generated Simulink artifacts such as slprj/, *.slxc, autosaves, cache folders and generated HTML reports should not be committed.


13. Main MATLAB files

File Role
mainPSO.m Sequential PSO entry point
mainPPSO.m Parallel PSO entry point
funzioni/calcoloFitness.m Fitness evaluation linked to the evacuation model
funzioni/PSO.m Sequential Particle Swarm Optimization implementation
funzioni/parallelPSO.m Parallel Particle Swarm Optimization implementation
inizializzazioni/ Initialization scripts for optimizer and SimEvents constants
Completo_direzioniDinamiche.slx Complete Simulink/SimEvents case-study model
building-elementary-blocks/DesignPattern.slx Library of reusable SimEvents evacuation blocks

14. Requirements

Expected MATLAB environment:

  • MATLAB;
  • Simulink;
  • SimEvents;
  • Parallel Computing Toolbox;
  • a configured MATLAB path including funzioni/ and inizializzazioni/.

The project depends on SimEvents for model execution. Without Simulink/SimEvents, the source code and saved results can still be inspected, but the full simulation-optimization loop cannot be reproduced.


15. How to run

Run the sequential optimizer from MATLAB:

mainPSO

Run the parallel optimizer:

mainPPSO

The scripts initialize the problem, load the model constants, execute the selected optimizer and plot the best-cost history.


17. Future work

Possible extensions include:

  • replacing probabilistic routing with fuzzy or rule-based decision logic;
  • formalizing the cost function analytically from throughput and queue states;
  • incorporating sensor-driven real-time occupancy information;
  • modeling the effect of acoustic alerts, displays and guidance signals on route compliance;
  • evaluating larger and more complex building layouts;
  • adding stochastic failures such as blocked corridors, unavailable exits or local hazards.

Author

Michele Abbaticchio
MSc Automation Engineering
Politecnico di Bari

This project was developed as a Bachelor's thesis in Computer Engineering and Automation.

About

Dynamic building evacuation optimization using MATLAB, SimEvents and Parallel Particle Swarm Optimization.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages