Commit 3c3130f6 authored by Christina's avatar Christina
Browse files

add comments

parent 9ae9ad10
Pipeline #676016 failed with stages
in 2 minutes and 20 seconds
......@@ -5,7 +5,6 @@ import org.apache.commons.math3.random.JDKRandomGenerator;
import org.apache.commons.math3.random.RandomGenerator;
import org.json.JSONArray;
import org.json.JSONObject;
import org.vadere.state.psychology.information.InformationState;
import org.vadere.state.psychology.perception.types.ChangeTarget;
import org.vadere.state.psychology.perception.types.Stimulus;
import org.vadere.state.scenario.Pedestrian;
......@@ -15,12 +14,23 @@ import java.util.Random;
RouteChoice divides agents into different corridors. How the agents are to be distributed in percentage to the respective aisles is described with the help of a probability distribution.
For a distribution
[1,2,5] -> aisle name
[0.8,0.2,0.0] -> probability == desired distribution
80% of the people should take aisle 1 and 20% aisle 2.
In reality, the drawing of the random aisle could be done with the help of an app.
* */
public class RouteChoice extends ControlModel {
private Random random;
public RouteChoice() {
// The seed for generating the random distribution is simply set to 0,
// since the allocation should actually be deterministic (people should always be divided in the same way).
random = new Random(0);
......@@ -63,6 +73,7 @@ public class RouteChoice extends ControlModel {
return dist.sample();
private EnumeratedIntegerDistribution getDiscreteDistribution(LinkedList<Integer> possibleTargets, LinkedList<Double> probs){
RandomGenerator rng = new JDKRandomGenerator(random.nextInt());
......@@ -71,8 +82,6 @@ public class RouteChoice extends ControlModel { -> i).toArray());
// read required target distribution from json, read acceptance rate from json
private LinkedList<Integer> readTargetsFromJson(JSONObject command) {
LinkedList<Integer> targets = new LinkedList<>();
JSONArray targetList = (JSONArray) command.get("targetIds");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment