Evacuation Continuous Move

Julien Mazars edited this page May 24, 2016 · 2 revisions

continuous_move

Author : Patrick Taillandier

A 3D model which show how to represent an evacuation system with obstacles, cohesion factor and velocity. The people are placed randomly and have to escape by going to a target point

Code of the model :

model continuous_move 
global { 
	//Shapefile of the buildings
	file building_shapefile <- file("../includes/building.shp");
	//Shape of the environment
	geometry shape <- envelope(building_shapefile);
	int maximal_turn <- 90; //in degree
	int cohesion_factor <- 10;
	//Size of the people
	float people_size <- 2.0;
	//Space without buildings
	geometry free_space;
	//Number of people agent
	int nb_people <- 500;
	//Point to evacuate
	point target_point <- {world.location.x, 0};
	init { 
		
		free_space <- copy(shape);
		//Creation of the buildinds
		create building from: building_shapefile {
			//Creation of the free space by removing the shape of the different buildings existing
			free_space <- free_space - (shape + people_size);
		}
		//Simplification of the free_space to remove sharp edges
		free_space <- free_space simplification(1.0);
		//Creation of the people agents
		create people number: nb_people {
			//People agents are placed randomly among the free space
			location <- any_location_in(free_space);
			target_loc <-  target_point;
		} 		 	
	}	
}
//Species which represent the building 
species building {
	//Height of the buildings
	float height <- 3.0 + rnd(5);
	aspect default {
		draw shape color: #gray depth: height;
	}
}
//Species people which move to the evacuation point using the skill moving
species people skills:[moving]{
	//Target point to evacuate
	point target_loc;
	//Speed of the agent
	float speed <- 0.5 + rnd(1000) / 1000;
	//Velocity of the agent
	point velocity <- {0,0};
	//Direction of the agent taking in consideration the maximal turn an agent is able to make
	int heading max: heading + maximal_turn min: heading - maximal_turn;
	
	//Size of the agent
	float size <- people_size;
	rgb color <- rgb(rnd(255),rnd(255),rnd(255));
		
	//Reflex to kill the agent when it has evacuated the area
	reflex end when: location distance_to target_loc <= 2 * people_size{
		write name + " is arrived";
		do die;
	}
	//Reflex to compute the velocity of the agent considering the cohesion factor
	reflex follow_goal  {
		velocity <- velocity + ((target_loc - location) / cohesion_factor);
	}
	//Reflex to apply separation when people are too close from each other
	reflex separation {
		point acc <- {0,0};
		ask (people at_distance size)  {
			acc <- acc - (location - myself.location);
		}  
		velocity <- velocity + acc;
	}
	//Reflex to avoid the different obstacles
	reflex avoid { 
		point acc <- {0,0};
		list<building> nearby_obstacles <- (building at_distance people_size);
		loop obs over: nearby_obstacles {
			acc <- acc - (obs.location - location);
		}
		velocity <- velocity + acc; 
	}
	//Reflex to move the agent considering its location, target and velocity
	reflex move {
		point old_location <- copy(location);
		do goto target: location + velocity ;
		if (not empty(building overlapping self )) {
			location <- point((location closest_points_with free_space)[1]);
		}
		velocity <- location - old_location;
	}	
	aspect default {
		draw pyramid(size) color: color;
		draw sphere(size/3) at: {location.x,location.y,size} color: color;
	}
}

experiment main type: gui {
	parameter "nb people" var: nb_people min: 1 max: 1000;
	output {
		display map type: opengl {
			species building refresh: false;
			species people;
			graphics "exit" refresh: false {
				draw sphere(2 * people_size) at: target_point color: #green;	
			}
		}
	}
}

Home

Introduction

Changes from 1.6.1 to 1.8

Platform

  1. Installation and Launching
  2. Installation
  3. Launching GAMA
  4. Headless Mode
  5. Updating GAMA
  6. Installing Plugins
  7. Troubleshooting
  8. Workspace, Projects and Models
  9. Navigating in the Workspace
  10. Changing Workspace
  11. Importing Models
  12. Editing Models
  13. GAML Editor (Generalities)
  14. GAML Editor Toolbar
  15. Validation of Models
  16. Running Experiments
  17. Launching Experiments
  18. Experiments User interface
  19. Menus and commands
  20. Parameters view
  21. Inspectors and monitors
  22. Displays
  23. Batch Specific UI
  24. Errors View
  25. Preferences

Learn GAML step by step

  1. Introduction
  2. Start with GAML
  3. Organization of a Model
  4. Basic programming concepts in GAML
  5. Manipulate basic Species
  6. Global Species
  7. Regular Species
  8. Defining Actions and Behaviors
  9. Interaction between Agents
  10. Attaching Skills
  11. Inheritance
  12. Defining Advanced Species
  13. Grid Species
  14. Graph Species
  15. Mirror Species
  16. Multi-Level Architecture
  17. Defining GUI Experiment
  18. Defining Parameters
  19. Defining Displays Generalities
  20. Defining Charts
  21. Defining 3D Displays
  22. Defining Monitors and Inspectors
  23. Defining Export files
  24. Defining User Interaction
  25. Exploring Models
  26. Run Several Simulations
  27. Batch Experiments
  28. Exploration Methods
  29. Optimizing Model Section
  30. Runtime Concepts
  31. Optimizing Models
  32. Multi-Paradigm Modeling
  33. Control Architecture
  34. Defining Equations

Recipes

  1. Manipulate OSM Datas
  2. Diffusion
  3. Using Database
  4. Calling R
  5. Using FIPA ACL
  6. Using GamAnalyzer
  7. Using BDI
  8. Using Driving Skill
  9. Manipulate dates
  10. Manipulate lights
  11. Using comodel
  12. Save and restore Simulations
  13. Using network
  14. Headless mode
  15. FAQ
  16. Known Issues

GAML References

  1. Built-in Species
  2. Agent Built-in
  3. Model Built-in
  4. Experiment Built-in
  5. Built-in Skills
  6. Built-in Architecture
  7. Statements
  8. Data Type
  9. File Type
  10. Expressions
  11. Literals
  12. Units and Constants
  13. Pseudo Variables
  14. Variables And Attributes
  15. Operators [A-A]
  16. Operators [B-C]
  17. Operators [D-H]
  18. Operators [I-M]
  19. Operators [N-R]
  20. Operators [S-Z]
  21. Index

Tutorials

  1. Predator Prey
  2. Road Traffic
  3. 3D Tutorial
  4. Incremental Model
  5. Luneray's flu
  6. Co-modeling
  7. BDI Agents

Pedagogical materials

Developing Extensions

  1. Installing the GIT version
  2. Architecture of GAMA
  3. Developing a Plugin
  4. Developing a Skill
  5. Developing a Statement
  6. Developing an Operator
  7. Developing a Type
  8. Developing a Species
  9. Developing a Control Architecture
  10. Index of annotations
  11. IScope
  12. Creating a release of GAMA
  13. Documentation generation
  14. Website generation

Scientific References

Projects using GAMA

Training Session

Events

Older versions

Coding Camp

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.