Code Monkey home page Code Monkey logo

crowd-evacuation's Introduction

Crowd evacuation simulation

This repository contains the implementation of related article that was written as a part of Crowd behaviour course at the Faculty of Computer and Information Science at the University of Ljubljana.

Description

Each year a lot of terrorist attacks happen all over the world where a lot of people are killed or heavily damaged. With hope to decrease the casualties of such attacks, we present a crowd evacuation simulation that uses fuzzy logic to simulate the movement of people and assailants in different rooms.

First we prepare models for achieving specific goals: obstacle avoidance, path searching and goal seeking. We then integrate these models together by setting a weight for each of the models, which determines how much each of the models affects the object's movement. We test the algorithm by simulating evacuation in different rooms that we prepared in advance. For better understanding of the simulation and creation of different rooms, user interface is implemented.

The article and implementation is based on existing article: Zhou, Min & Dong, Hairong & Wen, Ding & Yao, Xiuming & Sun, Xubin. (2016). Modeling of Crowd Evacuation With Assailants via a Fuzzy Logic Approach. IEEE Transactions on Intelligent Transportation Systems, which can be found here.

Repository structure

The repository contains the following folders:

  • article contains the latex files and the article in pdf
  • maps contains saved simulation rooms
  • presentation contains video and ppt presentation
  • results contains different simulations' results
  • src contains the code

Live demo

Live demo is deployed via GitHub pages and is available here.

Running locally

To run the visualization locally you just have to clone the repo

clone https://github.com/Blarc/crowd-evacuation.git

and open index.html in your favourite browser or run it on a local server:

cd crowd-evacuation
# for python3
python -m http.server

For different ways of setting up a local server you can check out link.

Live demo

Live demo can be seen here.

User interface

For creating rooms and running simulations you either have to upload a saved configuration or create your own. Some saved configurations are saved in folder maps. If you would like to create and run your own simulations, you can do so with different mouse modes, that can be enabled via keyboard:

Drawing

  • D - enables drawing obstacles mode
  • P - enables drawing pedestrians mode
  • A - enables drawing assailant mode
  • I - enables drawing pedestrians with custom goal mode (first click creates pedestrian, second click creates goal)
  • E - enables erasing mode
  • C - clears all created obstacles, pedestrians and assailants
  • Size - change the obstacle's size when drawing

Visual aids

  • V - hide / show pedestrian arcs
  • K - hide / show assailnt arcs

Simulation manipulation

  • SPACE - pause / resume simulation
  • U - remove all global and local goals
  • R - reset simulation (clears and resets the simulation, if preloaded configuration exists)
  • Width / Height - changes the size of the room

Saving / downloading

  • S - download current configuration of the simulation (created obstacles, pedestrians and assailants)
  • Choose file - upload saved simulation configuration
  • Run simulations - automatically resets simulation when there is no pedestrians left in the room and saves statistics each second
  • T - download simulation statistics

Acknowledgments

External libraries have been used for the visualization:

  • p5.js: for drawing everything to the screen (link)
  • quadtree.js: optimisation for calculating interactions between objects (link)

crowd-evacuation's People

Contributors

blarc avatar mmarolt avatar

Watchers

 avatar  avatar

crowd-evacuation's Issues

Fix ObstacleAvoiding

Prevent obstacles from crashing into each other:

  • add a stop condition, which makes the objects stop when they are too close
  • implement logic for moving of objects after stop
  • randomly decide the angle when suitable in obstacle avoiding rules (i.e. rule 10)

Fix VArc.isInArc function

VArc.isPointInArc currently checks if point is in arc. We would like it to check if an object (circle, rectangle) with specified size is in arc. Try to figure out how to check for rectangles and circles, since they'll be needed for obstacles.

  • VArc.isCircleInArc(...)
  • VArc.isRectInArc(...)

Fix obstacle drawing

When drawing larger obstacles, they can't be placed one obstacle away from each other.

Obstacle avoidance: predict the next position

Rather than reacting (rotating the object) based on the current positions of the obstacles (or other objects), calculate the next position of the obstacles (or objects) by adding their velocity to their current position and decide based on that position.

The current position of the obstacle is irrelevant. We want to turn in such direction, that we won't crash into it after rotating.
(Maybe event multiply obstacle's velocity to predict for more than one frame in advance)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.