Commit 8b4bd96d authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

remove the old busy implementation of minStepSize and insert the new lazy one.

parent bc9f5c0f
Pipeline #86538 failed with stages
in 54 seconds
...@@ -143,6 +143,10 @@ public class PedestrianOSM extends Pedestrian { ...@@ -143,6 +143,10 @@ public class PedestrianOSM extends Pedestrian {
refreshRelevantPedestrians(); refreshRelevantPedestrians();
nextPosition = stepCircleOptimizer.getNextPosition(this, reachableArea); nextPosition = stepCircleOptimizer.getNextPosition(this, reachableArea);
if(attributesOSM.isMinimumStepLength() && getPosition().distance(nextPosition) < minStepLength) {
nextPosition = getPosition();
}
} else { } else {
stairStepOptimizer = new StairStepOptimizer(stairs); stairStepOptimizer = new StairStepOptimizer(stairs);
reachableArea = new VCircle(getPosition(), stairs.getTreadDepth() * 1.99); reachableArea = new VCircle(getPosition(), stairs.getTreadDepth() * 1.99);
...@@ -154,10 +158,6 @@ public class PedestrianOSM extends Pedestrian { ...@@ -154,10 +158,6 @@ public class PedestrianOSM extends Pedestrian {
} }
} }
/*if(attributesOSM.isMinimumStepLength() && getPosition().distance(nextPosition) < minStepLength) {
nextPosition = getPosition();
}*/
} }
/** /**
......
...@@ -134,9 +134,7 @@ public class PotentialEvaluationFunction implements UnivariateRealFunction, ...@@ -134,9 +134,7 @@ public class PotentialEvaluationFunction implements UnivariateRealFunction,
} }
} }
if (Math.pow(newPos.x - pedPos.x, 2) + Math.pow(newPos.y - pedPos.y, 2) <= Math.pow(stepSize, 2) + 0.00001 if (Math.pow(newPos.x - pedPos.x, 2) + Math.pow(newPos.y - pedPos.y, 2) <= Math.pow(stepSize, 2) + 0.00001) {
&& Math.pow(newPos.x - pedPos.x, 2) + Math.pow(newPos.y - pedPos.y, 2) >= Math.pow(this.minStepSize, 2)
- 0.00001) {
result = pedestrian.getPotential(newPos); result = pedestrian.getPotential(newPos);
} }
counter++; counter++;
......
...@@ -13,23 +13,107 @@ import org.vadere.state.types.UpdateType; ...@@ -13,23 +13,107 @@ import org.vadere.state.types.UpdateType;
@ModelAttributeClass @ModelAttributeClass
public class AttributesOSM extends Attributes { public class AttributesOSM extends Attributes {
/**
* <p>
* Parameter of the optimization method: the number of points on the most outer circle.
* These points will be used in different ways which depends on the {@link OptimizationType}.
* </p>
* <ul>
* <li>OptimizationType.NELDER_MEAD (default): each neighbouring pair of points and the agent position is used as a starting simplex</li>
* <li>OptimizationType.PSO: each point and the position of the agent is used as a starting position of a particle</li>
* <li>OptimizationType.DISCRETE: each point is and the position of the agent is used to directly evaluate the evaluation function</li>
* </ul>
*/
private int stepCircleResolution = 4; private int stepCircleResolution = 4;
/**
* <p>
* Parameter of the optimization method: the number of circles. Together with the {@link AttributesOSM#stepCircleResolution}
* this gives the number of points used by the optimization solver.
* </p>
*/
private int numberOfCircles = 1; private int numberOfCircles = 1;
/**
* <p>
* Parameter of the optimization method: Specifies the concrete optimization solver.
* </p>
*/
private OptimizationType optimizationType = OptimizationType.NELDER_MEAD;
private boolean varyStepDirection = true; private boolean varyStepDirection = true;
/**
* Used to compute the desired step length which is
* {@link AttributesOSM#stepLengthIntercept} + {@link AttributesOSM#stepLengthSlopeSpeed} * speed.
* (see seitz-2016 page 71 or seitz-2012).
*/
private double stepLengthIntercept = 0.4625; private double stepLengthIntercept = 0.4625;
/**
* Used to compute the desired step length which is
* {@link AttributesOSM#stepLengthIntercept} + {@link AttributesOSM#stepLengthSlopeSpeed} * speed + error
* (see seitz-2016 page 71 or seitz-2012).
*/
private double stepLengthSlopeSpeed = 0.2345; private double stepLengthSlopeSpeed = 0.2345;
/**
* Used to compute the error term of the desired step length i.e. the standard deviation of the normal
* distribution which is the distribution of the error variable.
* (see seitz-2016 page 71 or seitz-2012).
*/
private double stepLengthSD = 0.036; private double stepLengthSD = 0.036;
/**
* Only used if {@link OptimizationType} is equal DISCRETE. If the potential does not improve by this
* movementThreshold, the agent will not move.
*/
private double movementThreshold = 0; private double movementThreshold = 0;
private double minStepLength = 0.4625; /**
* Only used if {@link AttributesOSM#minimumStepLength} is true. The agent will not move if the
* next improvement is less than {@link AttributesOSM#minStepLength} away from its current position.
* Furthermore, this will be ignored if an agent is on stairs.
*/
private double minStepLength = 0.10;
/**
* If true enables the use of {@link AttributesOSM#minStepLength}. This attribute could be removed.
*/
private boolean minimumStepLength = true;
/**
* The maximum amount of time a foot step of an agent can take. If the foot step takes more time
* its duration is reduced to {@link AttributesOSM#maxStepDuration}.
*/
private double maxStepDuration = Double.MAX_VALUE; private double maxStepDuration = Double.MAX_VALUE;
private OptimizationType optimizationType = OptimizationType.NELDER_MEAD; /**
* Only used if {@link OptimizationType} is equal DISCRETE. Reduces the disc of the optimization to
* a cone (see seitz-2016 page 76).
*/
private MovementType movementType = MovementType.ARBITRARY; private MovementType movementType = MovementType.ARBITRARY;
private boolean dynamicStepLength = false;
/**
* SpeedAdjuster will only be active if this is true. For example this has to be true if the group model is
* active.
*/
private boolean dynamicStepLength = true;
/**
* Specifies which update schema is used. The OSM should use the event driven update schema
* (see seitz-2014b)
*/
private UpdateType updateType = UpdateType.EVENT_DRIVEN; private UpdateType updateType = UpdateType.EVENT_DRIVEN;
/**
* If true this avoids agent jumping over small walls. However, this does not fix the problem that
* the target potential computation fails due to small obstacles. Since this is a quick fix and the
* test is very expensive the default should be false!
*/
private boolean seeSmallWalls = false; private boolean seeSmallWalls = false;
private boolean minimumStepLength = true;
private String targetPotentialModel = "org.vadere.simulator.models.potential.fields.PotentialFieldTargetGrid"; private String targetPotentialModel = "org.vadere.simulator.models.potential.fields.PotentialFieldTargetGrid";
private String pedestrianPotentialModel = "org.vadere.simulator.models.potential.PotentialFieldPedestrianCompactSoftshell"; private String pedestrianPotentialModel = "org.vadere.simulator.models.potential.PotentialFieldPedestrianCompactSoftshell";
private String obstaclePotentialModel = "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell"; private String obstaclePotentialModel = "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell";
......
Supports Markdown
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