-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.interfaces.SteeringStrategy
public class Weighted<T extends Object> implements SteeringStrategy<T, Euclidean2DPosition>
A SteeringStrategy performing a weighted sum of steering actions (see computeNextPosition).
-
-
Constructor Summary
Constructors Constructor Description Weighted(Euclidean2DEnvironment<T> environment, Pedestrian2D<T> pedestrian, Function1<SteeringAction<T, Euclidean2DPosition>, Double> weight)
-
Method Summary
Modifier and Type Method Description Euclidean2DPositioncomputeNextPosition(List<SteeringAction<T, Euclidean2DPosition>> actions)actions are partitioned in group steering actions and non-group steering actions. Euclidean2DPositioncomputeTarget(List<SteeringAction<T, Euclidean2DPosition>> actions)If there's no SteeringActionWithTarget among the provided actions, a zero vector is returned. -
-
Constructor Detail
-
Weighted
Weighted(Euclidean2DEnvironment<T> environment, Pedestrian2D<T> pedestrian, Function1<SteeringAction<T, Euclidean2DPosition>, Double> weight)
- Parameters:
environment-the environment in which the pedestrian moves.pedestrian-the owner of the steering actions combined by this strategy.weight-lambda used to assign a weight to each steering action: the higher the weight, the greater the importance of the action.
-
-
Method Detail
-
computeNextPosition
Euclidean2DPosition computeNextPosition(List<SteeringAction<T, Euclidean2DPosition>> actions)
actions are partitioned in group steering actions and non-group steering actions. The overall next position for each of these two sets of actions is computed via weighted sum. The resulting vectors are then summed together (with unitary weight).
- Parameters:
actions-the list of actions to combine.
-
computeTarget
Euclidean2DPosition computeTarget(List<SteeringAction<T, Euclidean2DPosition>> actions)
If there's no SteeringActionWithTarget among the provided actions, a zero vector is returned. Otherwise, the closest target is picked.
- Parameters:
actions-the list of actions to combine.
-
-
-
-