From dd6fb90fb83dcda4ba9017be24581c20b497ed59 Mon Sep 17 00:00:00 2001
From: Mohcine Chraibi <m.chraibi@fz-juelich.de>
Date: Thu, 29 Jun 2017 13:05:12 +0200
Subject: [PATCH] Update 2016-03-24-latex.md

---
 _posts/2016-03-24-latex.md | 315 +++++++++++++++++++++++++++++++++----
 1 file changed, 286 insertions(+), 29 deletions(-)

diff --git a/_posts/2016-03-24-latex.md b/_posts/2016-03-24-latex.md
index 8ecf666..4a3d8cb 100644
--- a/_posts/2016-03-24-latex.md
+++ b/_posts/2016-03-24-latex.md
@@ -5,45 +5,302 @@ date: 2017-03-05
 tags: ["example", "math"]
 ---
 
-KaTeX can be used to generate complex math formulas server-side. 
 
-$$
-\phi = \frac{(1+\sqrt{5})}{2} = 1.6180339887\cdots
-$$
+<!-- START doctoc generated TOC please keep comment here to allow auto update -->
+<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
+**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*
 
-Additional details can be found on [GitHub](https://github.com/Khan/KaTeX) or on the [Wiki](http://tiddlywiki.com/plugins/tiddlywiki/katex/).
-<!--more-->
+- [General model parameters (for all models)](#general-model-parameters-for-all-models)
+- [Model_parameters](#model_parameters)
+- [Agent_parameters](#agent_parameters)
+    - [Desired speed](#desired-speed)
+    - [Shape of pedestrians](#shape-of-pedestrians)
+- [Generalized Centrifugal Force Model](#generalized-centrifugal-force-model)
+- [Gompertz model](#gompertz-model)
+- [Collision-free speed model](#collision-free-speed-model)
+    - [Model parameters](#model-parameters)
+    - [Agent parameters (recommendations)](#agent-parameters-recommendations)
+- [Wall-avoidance model](#wall-avoidance-model)
+    - [Parameters](#parameters)
+- [Generalized Centrifugal Force Model with lateral swaying](#generalized-centrifugal-force-model-with-lateral-swaying)
 
-### Example 1
+<!-- END doctoc generated TOC please keep comment here to allow auto update -->
 
-If the text between $$ contains newlines it will rendered in display mode:
+
+Several operational models are implemented in `jpscore`. 
+An operational model defines how pedestrians moves from one time step to the next.
+In the definition of agent's properties it is mandatory to precise the number of the model to be used e.g.:
+
+```xml
+<agents operational_model_id="n">
 ```
-$$
-f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
-$$
+
+where `n` is 1, 2, 3, 4 or 5.
+
+
+### General model parameters (for all models)
+The definition of any model parameter is composed of two different 
+sections: 
+
+- **model_parameters**: Model specific parameter. See below in the different model sections.
+- **agent_parameters**: These parameter are mainly specific for the shape of pedestrians 
+    or other pedestrian properties like desired speed, reaction time etc.
+
+### Model_parameters
+- `<solver>euler</solver>`
+     - The solver for the ODE. Only *Euler*. No other options.
+- `<stepsize>0.001</stepsize>`: 
+     - The time step for the solver. This should be choosed with care. For force-based model it is recommended to take a value between $`10^{-2} `$ and $`10^{-3}`$ s.
+       For first-order models, a value of 0.05 s should be OK.
+       A larger time step leads to faster simulations, however it is too risky and can lead to 
+numerical instability, collisions and overlapping among pedestrians.
+     - Unit: s 
+- `<periodic>0</periodic>`
+     - Set to 1 if a system with closed boundary conditions should be simulated. Default setting is 0.
+     - This option is only implemented in *Tordeux2015* and is very geometry-specific (only for corridors) with predefined settings. See Utest/Validation/1test_1D/ for a use case.
+     
+- `<exit_crossing_strategy>3</exit_crossing_strategy>`
+     - Positive values in $`[1, 9]`$. See [Direction strategies](2016-11-02-direction.html) for the definition of the strategies.
+     
+- `<linkedcells enabled="true" cell_size="2"/>`
+     - Defines the size of the cells. This is important to get the neighbors of a pedestrians, which
+       are all pedestrians within the eight neighboring cells. Larger cells, lead so slower simulations, since
+       more pedestrian-pedestrian interactions need to be calculated.
+     - Unit: m
+
+
+### Agent_parameters
+The *agent parameters* are mostly identical for all models. Exceptions will be mentioned explicitly. 
+
+The parameters that can be specified in this section are Gauss distributed (default value are given). 
+
+#### Desired speed
+- `<v0 mu="1.2" sigma="0.0" />` 
+    - Desired speed
+    - Unit: m/s
+- `<v0_upstairs mu="0.6" sigma="0.167" />`
+    - Desired speed upstairs
+    - Unit: m/s
+- `<v0_downstairs mu="0.6" sigma="0.188" />`
+    - Desired speed downstairs
+    - Unit: m/s
+- `<v0_idle_escalator_upstairs mu="0.6" sigma="0.0" />`
+    - Speed of idle escalators upstairs
+    - Unit: m/s
+- `<v0_idle_escalator_downstairs mu="0.6" sigma="0.0" />`
+    - Speed of idle escalators downstairs
+    - Unit: m/s
+
+#### Shape of pedestrians
+Pedestrians are modeled as ellipses with two semi-axes: $`a`$ and $`b`$, where
+
+$`
+a= a_{min} + a_{\tau}v, 
+`$
+
+and
+
+$`
+b = b_{max} - (b_{max}-b_{min})\frac{v}{v^0}.
+`$
+
+$`v`$ is the peed of a pedestrian.
+
+- `<bmax mu="0.15" sigma="0.0" />`
+    - Maximal length of the shoulder semi-axis
+    - Unit: m
+- `<bmin mu="0.15" sigma="0.0" />`
+    - Minimal length of the shoulder semi-axis
+    - Unit: m
+- `<amin mu="0.15" sigma="0.0" />`
+    - Minimal length of the movement semi-axis. This is the case when $`v=0`$.
+    - Unit: m  
+- `<atau mu="0." sigma="0.0" />`  
+    - (Linear) speed-dependency of the movement semi-axis  
+    - Unit: s  
+  
+Other parameters in this section are:
+
+- `<tau mu="0.5" sigma="0.0" />`
+    - Reaction time. This constant is used in the driving force of the force-based forces. Small $`\rightarrow`$ instantaneous acceleration.
+    - Unit: s
+- `<T mu="1" sigma="0.0" />`
+    - Specific parameter for model 3 (Tordeux2015). Defines the slope of the speed function. 
+  
+### Generalized Centrifugal Force Model
+[Generalized Centrifugal Force Model][#GCFM] is a force-based model.
+
+Usage:
+
+```xml
+<model operational_model_id="1" description="gcfm">
 ```
-$$
-f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
-$$
 
+### Gompertz model
+[Gompertz Model][#gompertz] is a force-based model.
 
-### Example 2
+Usage:
+
+```xml
+<model operational_model_id="2" description="gompertz">
 ```
-$$
-\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } }
-$$
+
+
+### Collision-free speed model
+[Collision-free speed model][#Tordeux2015] is a velocity-based model. See also this [talk](https://fz-juelich.sciebo.de/index.php/s/1pYFETbvJdJDusE) for more details about the model.
+
+Usage:
+
+```xml
+<model operational_model_id="3" description="Tordeux2015">
 ```
-​​$$
-\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } }
-$$
-​​ 
 
-### Example 3
+#### Model parameters
+Besides the options defined in [Mode_parameters](#model_parameters) the following options are necessary for this model:
+
+- `<force_ped  a="5" D="0.2"/>`
+     - The influence of other pedestrians is triggered by $`a`$ and $`D`$ where $`a`$ is the strength if the interaction and $`D`$ gives its range. The naming may be misleading, since the model is **not** force-based, but velocity-based. 
+     - Unit: m
+- `<force_wall a="5" D="0.02"/>`: 
+     - The influence of  walls is triggered by $`a`$ and $`D`$ where $`a`$ is the strength if the interaction and $`D`$ gives its range. A larger value of $`D`$ may lead to blockades, especially when passing narrow bottlenecks.
+     - Unit: m
+     
+The names of the aforementioned parameters might be misleading, since the model is *not* force-based. The naming will be changed in the future.
+
+#### Agent parameters (recommendations)
+Actually, this model assumes circular pedestrian's shape, therefore the parameter for the semi-axes [Agent_parameters](#agent_parameters) should be chosen, such that circles with constant radius can be obtained.
+For example: 
+
+```xml
+<bmax mu="0.15" sigma="0.0" />
+<bmin mu="0.15" sigma="0.0" />
+<amin mu="0.15" sigma="0.0" />
+<atau mu="0." sigma="0.0" />
 ```
-$$
-1 +  \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for }\lvert q\rvert<1.
-$$
+
+This defines circles with radius 15 cm.
+
+
+In summary the relevant section for this model could look like:
+
+```xml
+<model operational_model_id="3" description="Tordeux2015">
+    <model_parameters>
+        <solver>euler</solver>
+        <stepsize>0.05</stepsize>
+        <exit_crossing_strategy>3</exit_crossing_strategy>
+        <linkedcells enabled="true" cell_size="2"/>
+        <force_ped  a="5" D="0.2"/>
+        <force_wall a="5" D="0.02"/>
+    </model_parameters>
+    <agent_parameters agent_parameter_id="1">
+        <v0 mu="1.34" sigma="0.0" />
+        <v0_upstairs mu="0.668" sigma="0.167" />
+        <v0_downstairs mu="0.750" sigma="0.188" />
+        <v0_idle_escalator_upstairs mu="0.5" sigma="0.0" />
+        <v0_idle_escalator_downstairs mu="0.5" sigma="0.0" />
+        <bmax mu="0.15" sigma="0.0" />
+        <bmin mu="0.15" sigma="0.0" />
+        <amin mu="0.15" sigma="0.0" />
+        <atau mu="0." sigma="0.0" />
+        <tau mu="0.5" sigma="0.0" />
+        <T mu="1" sigma="0.0" />
+    </agent_parameters>
+</model>
+```
+
+### Wall-avoidance model
+
+[Wall-avoidance model][#ModelGraf2015] is a velocity-based model. The Wall-Avoidance Model focuses on valid pedestrian positions. The interaction of agents with walls takes precedence over the agent-to-agent interaction. There are two key aspects:
+
+* In the vicinity to walls, agents take on a different behaviour, slowing them down (parameter: slowdowndistance)
+
+ * Agents follow special floorfields, directing them to the targets/goals, which will have them avoid walls if possible (free space)
+
+Valid exit strategies are {6, 8, 9}. Please see details below.
+
+
+(Sample) Usage:
+
+```xml
+<model operational_model_id="4" description="gradnav">
+  <model_parameters>
+    <solver>euler</solver>
+    <stepsize>0.01</stepsize>
+    <exit_crossing_strategy>9</exit_crossing_strategy>
+    <floorfield delta_h="0.0625" wall_avoid_distance="0.4" 
+        use_wall_avoidance="true" />
+    <linkedcells enabled="true" cell_size="4.2" />
+    <force_ped nu="3" b="1.0" c="3.0" />
+    <force_wall nu="1" b="0.70" c="3.0" />
+    <anti_clipping slow_down_distance=".2" />
+  </model_parameters>
+  <agent_parameters agent_parameter_id="0">
+    <v0 mu="1.5" sigma="0.0" />
+    <bmax mu="0.25" sigma="0.001" />
+    <bmin mu="0.20" sigma="0.001" />
+    <amin mu="0.18" sigma="0.001" />
+    <tau mu="0.5" sigma="0.001" />
+    <atau mu="0.23" sigma="0.001" />
+  </agent_parameters>
+</model>
+```
+
+#### Parameters ####
+
+- `<exit_crossing_strategy>[6, 8, 9]</exit_crossing_strategy>`
+  The strategies 6, 8 and 9 differ only in the way the floorfield is created:
+  - 6: one floorfield over all geometry (building); only in 2D geometries; directing every agent to the closest exit
+  - 8: multiple floorfield-objects (one for every __room__); each object can create a floor field on the fly to a target line (or vector of lines) within the room; working in multi-floor-buildings; requires a router that provides intermediate targets in the same room
+  - 9: (__recommended__) multiple floorfield-objects (one for every __subroom__); 
+       each object can create a floor field on the fly to a target line (or vector of lines) 
+       within the same subroom; working in multi-floor-buildings; 
+       requires a router that provides intermediate targets in the same subroom;
+
+- `<floorfield delta_h="0.0625" wall_avoid_distance="0.4" use_wall_avoidance="true" />`
+     - The parameters define:
+          - __delta_h__: discretization/stepsize of grid-points used by the floor field
+          - __wall_avoid_distance__: below this wall-distance, the floor field will show a wall-repulsive character, directing agents away from the wall
+          - __use_wall_avoidance__: {true, false} switch to turn on/off the enhancement of the floor field
+<img src="https://cst.version.fz-juelich.de/jupedsim/jpscore/uploads/785cda284f5f44d2b019332d29b8075e/transformFF.png" width="300" height="300" />
+         
+- `<linkedcells enabled="true" cell_size="4.2" />`
+  - range in which other pedestrians are considered neighbours and can influence the current agent. This value defines cell-size of the cell-grid.
+
+### Generalized Centrifugal Force Model with lateral swaying
+
+The [Generalized Centrifugal Force Model with lateral swaying][#Krausz] is mostly identical to the GCFM Model, 
+but instead of a variable semi-axis $`b`$ of the ellipse simulating the pedestrian, pedestrians perform an oscillation perpendicular to their direction of motion.
+As a consequence the parameter `Bmax` is ignored. 
+
+Usage:
+
+```xml
+<model operational_model_id="5" description="krausz">
 ```
-$$
-1 +  \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for }\lvert q\rvert<1.
-$$
+
+Four Parameters can be passed to control the lateral swaying, for example:
+
+`<sway ampA="-0.14" ampB="0.21" freqA="0.44" freqB="0.35" />`
+
+- `ampA` and `ampB` determine the amplitude of the oscillation according to the linear relation 
+   $`A = \texttt{ampA} \cdot \| v_i \| + \texttt{ampB}`$.
+
+- `freqA` and `freqB` determine the frequency of the oscillation according to 
+   $`f = \texttt{freqA} \cdot \| v_i \| + \texttt{freqB}`$.
+
+Setting `ampA` and `ampB` to 0 disables lateral swaying. If not specified, the empirical values given in [Krausz, 2012][#Krausz] are used, that is:
+
+- `ampA` = -0.14, `ampB` = 0.21 and
+- `freqA` = 0.44, `freqB` = 0.25.
+
+
+[#GCFM]: http://journals.aps.org/pre/abstract/10.1103/PhysRevE.82.046111 "Mohcine Chraibi, Armin Seyfried, and Andreas Schadschneider Phys. Rev. E 82, 046111"
+
+[#gompertz]: http://trg-india.org/trg_conference_2015 "Kemloh Wagoum, Armel Ulrich, Mohcine Chraibi, Jun Zhang and Gregor Lämmel. JuPedSim: An Open Framework for Simulating and Analyzing the Dynamics of Pedestrians. In 3rd Conference of Transportation Research Group of India, 2015."
+
+[#Tordeux2015]: http://arxiv.org/abs/1512.05597  "Tordeux, Antoine, Chraibi, Mohcine and Seyfried, Armin, Collision-free speed model for pedestrian dynamics. In Traffic and Granular Flow  '15, to appear."
+
+[#ModelGraf2015]: https://fz-juelich.sciebo.de/index.php/s/VFnUCH2gtz1mSoL "Arne, Graf Master thesis"
+
+[#Krausz]: https://link.springer.com/chapter/10.1007/978-3-319-02447-9_61
-- 
GitLab