= Multi Agent System (MAS) = The embedded Multi Agent System (MAS) allows for the modeling of pedestrian movement in complex (urban) terrain. The following text provides an overview of the model's functionality as well as underlying concepts. This will cover the topics of creating a visibility graph, pathfinding, and Social Forces for collision avoidance. \\\\ For a list of input parameters, see [wiki:/doc/app/agtpar agents_par]. == Navigation == This section contains information concerning agent navigation. This includes preprocessing and online steps . === Visibility graph === Prior to a simulation using the MAS navigation information for the agents must be preprocessed. The result is a navigation mesh (visibility graph) that agents can use to find their way around obstacles toward their target. '''Concept'''\\\\ For agents to be able to find a path through an area containing obstacles (such as a city) some sort of graph is needed on which pathfinding can be performed. Such a graph consists of nodes that indicate physical locations and connections between these nodes annotated with a cost to travel between the two nodes.\\ The concept used here is called "visibility graph". It hinges on the idea that pedestrians use '''outer corners''' of obstacles to navigate. All spaces that pedestrians will not or cannot cross, such as buildings, trees, certain types of streets, etc are considered obstacles. The agent will walk toward the next visible corner on their way to their final target, make a turn, and walk toward the next corner. Thus, the nodes are the obstacle corners and a connection is established between two nodes if they are in view of each other and given the cost of the direct distance between the two. \\\\ To produce this data,\\ 1) the PALM building topographhy is '''converted to polygons''' (one per obstacle) containing all convex and cocave corners as vertices.\\ 2) The polygon data is '''simplified''' using the Douglas-Peucker algorithm ([#hershberger1994 Hershberger and Snoeyink, 1994]). To adjust the rate of simplification, see [#tolerance_dp tolerance_dp]. \\ 3) All remaining convex polygon vertices are added to the graph as nodes.\\ 4) Connections are established between each pair of nodes that are visible by each other. The associated cost is set to the direct distance.\\ 5) The polygon and graph data is output to a Fortran binary file that can be read by PALM.\\ '''Creating the visibility graph'''\\\\ A tool separate from PALM has been developed to calculate the visibility graph. It is a standalone Fortran program (find it at {{{UTIL/nav_mesh/nav_mesh.f90}}}). \\ ''' The usage of this tool is subject to chage! The following description is preliminary! ''' 1) Copy {{{nav_mesh.f90}}} to the {{{INPUT}}}-folder of your JOB.\\ 2) Compile it, including your NetCDF-libraries. At IMUK the command is (replace the paths according to your local NetCDF installation): {{{ ifort -cpp -I /muksoft/packages/netcdf4_hdf5parallel/4411c_443f/hdf5-1.10.0-patch1/mvapich2-2.3rc1/intel/2018.1.163/include/ \\ -L /muksoft/packages/netcdf4_hdf5parallel/4411c_443f/hdf5-1.10.0-patch1/mvapich2-2.3rc1/intel/2018.1.163/lib -D__netcdf -lnetcdf -lnetcdff nav_mesh.f90 }}} 3) Make sure your Input folder contains the relevant topography information in either an ASCII- or NetCDF-file ([wiki:doc/app/iofiles/pids#topo see here]).\\ 4) Make sure your Input folder contains the {{{_p3d}}}-file. In it, if necessary, specify the namelist {{{&prepro_par}}} with the parameters [#flag_2d flag_2d], [#internal_buildings internal_buildings] and [#tolerance_dp tolerance_dp].\\ 5) Execute the program {{{ ./a.out }}} This will create a file {{{_nav}}}. This is a Fortran binary file that contains the polygon and visibility graph data and will be read by PALM during the simulation. As long as the area and resulution of the model domain do not change this file can be reused. == Pathfinding == During the simulation each agent receives target coordinates (see [wiki:/doc/app/agtpar#at_x at_x] and [wiki:/doc/app/agtpar#at_y at_y]). Each agent must then find a path from its current position to its target using the visibility graph. This is accomplished using the '''A^*^(A-star)-algorithm''' which is a well-known fast pathfinding algorithm (click [#http://theory.stanford.edu/~amitp/GameProgramming/ here] for a thorough explanation). ''L'', ''u'',,∗,, as well as {{{ #!Latex $\overline{u_i^{\prime\prime} u_3^{\prime\prime}}$ }}} == NAMELIST group name: {{{agents_par}}}== ||='''Parameter Name''' =||='''[../fortrantypes FORTRAN Type]''' =||='''Default Value''' =||='''Explanation''' =|| |---------------- {{{#!td style="vertical-align:top; text-align:left;width: 150px" [=#tolerance_dp '''tolerance_dp''] }}} {{{#!td style="vertical-align:top; text-align:left;style="width: 50px" R * 5 }}} {{{#!td style="vertical-align:top; text-align:left;style="width: 75px" 100 * .F. }}} {{{#!td Array for simplification of building polygons during preprocessing.\\\\ }}} == References == * [=#hershberger1994] '''Hershberger J, Snoeyink J''' 1994. An O(''n''log''n'') implementation of the Douglas-Peucker algorithm for line simplification. SCG '94 Proceedings of the tenth annual symposium on Computational geometry. 383-384. [https://doi.org/10.1145/177424.178097 doi] * [=#detering1985] '''Detering HW, Etling D.''' 1985. Application of the ''E''-''ε'' turbulence model to the atmospheric boundary layer. Bound.-Lay. Meteorol. 33: 113–133.