Weighted

SteeringStrategy that computes the agent's next position as a weighted sum of steering actions.

Actions are partitioned into group steering actions (instances of GroupSteeringAction) and non-group steering actions. For each partition the strategy computes a weighted average of the actions' next positions using the provided weight lambda; the two resulting vectors are then summed (with unitary weight) to obtain the final displacement.

The weight parameter is an extension lambda on SteeringAction invoked as action.weight(). It must return a numeric weight (a non-negative Double) used to compute the weighted average. If the total weight of a partition is zero, the implementation falls back to the first action's next position; if there are no actions at all, the environment origin is returned.

The strategy also computes a target position by selecting the closest target among SteeringActionWithTarget actions; if none are present, the current node position is returned.

Parameters

environment

the environment in which the node moves.

node

the owner of the steering actions combined by this strategy.

weight

an extension lambda that assigns a numeric weight to each steering action.

Type Parameters

T

the concentration type of the simulation.

Inheritors

Constructors

Link copied to clipboard
constructor(environment: Euclidean2DEnvironment<T>, node: Node<T>, weight: SteeringAction<T, Euclidean2DPosition>.() -> Double)

Functions

Link copied to clipboard

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).

Link copied to clipboard

If there's no SteeringActionWithTarget among the provided actions, a zero vector is returned. Otherwise, the closest target is picked.