Package it.unibo.alchemist.model.implementations.actions

Generic actions implementations.

Types

Link copied to clipboard
abstract class AbstractAction<T> : Action<T>
An abstract class facility with some generic methods implemented.
Link copied to clipboard
abstract class AbstractActionOnSingleMolecule<T> : AbstractAction<T>
This class offers the basic structures to provide operations with numeric concentrations on a single molecule.
Link copied to clipboard
abstract class AbstractConfigurableMoveNode<T, P : Position<P>?> : AbstractMoveNode<T, P>
An abstract class that factorizes code for multiple different movements.
Link copied to clipboard
abstract class AbstractEuclideanConfigurableMoveNode<T, P : Position<P>, Vector<P>>(environment: Environment<T, P>, node: Node<T>, routing: RoutingStrategy<T, P>, target: TargetSelectionStrategy<T, P>, speed: SpeedSelectionStrategy<T, P>) : AbstractConfigurableMoveNode<T, P>

It's an AbstractConfigurableMoveNode in the Euclidean world, which provides a default interpolatePositions that is accurate with respect to the target given and the current maximum walking distance.

Link copied to clipboard
abstract class AbstractGroupSteeringAction<T, P : Position<P>, Vector<P>, A : GeometricTransformation<P>>(env: Environment<T, P>, reaction: Reaction<T>, pedestrian: Pedestrian<T, P, A>) : AbstractSteeringAction<T, P, A> , GroupSteeringAction<T, P>

An abstract GroupSteeringAction.

Link copied to clipboard
abstract class AbstractLayerAction(environment: Euclidean2DEnvironment<Number>, reaction: Reaction<Number>, pedestrian: Pedestrian2D<Number>, targetMolecule: Molecule) : AbstractSteeringAction<Number, Euclidean2DPosition, Euclidean2DTransformation>

Abstract implementation of an action influenced by the concentration of a given molecule in the environment.

Link copied to clipboard
abstract class AbstractLocalAction<T> : AbstractAction<T>
Link copied to clipboard
abstract class AbstractMoveNode<T, P : Position<P>?> : AbstractAction<T>
This action moves a node inside a given environment.
Link copied to clipboard
abstract class AbstractNavigationAction<T, P : Position<P>, Vector<P>, A : GeometricTransformation<P>, L : ConvexGeometricShape<P, A>, R, N : ConvexGeometricShape<P, A>, E>(environment: EnvironmentWithGraph<*, T, P, A, N, E>, reaction: Reaction<T>, pedestrian: OrientingPedestrian<T, P, A, L, R>) : AbstractSteeringAction<T, P, A> , NavigationAction<T, P, A, L, R, N, E>

An abstract NavigationAction, taking care of properly moving the pedestrian in the environment while delegating the decision on where to move it to a NavigationStrategy.

Link copied to clipboard
abstract class AbstractNeighborAction<T> : AbstractRandomizableAction<T>
Represents an action on a neighbor.
Link copied to clipboard
abstract class AbstractRandomizableAction<T> : AbstractAction<T>
Link copied to clipboard
abstract class AbstractSteeringAction<T, P : Position<P>, Vector<P>, A : GeometricTransformation<P>>(env: Environment<T, P>, reaction: Reaction<T>, pedestrian: Pedestrian<T, P, A>) : AbstractMoveNode<T, P> , SteeringAction<T, P>

A SteeringAction in a vector space. The implementation of nextPosition is left to subclasses.

Link copied to clipboard
abstract class AbstractSteeringActionWithTarget<T, P : Position<P>, Vector<P>, A : GeometricTransformation<P>>(environment: Environment<T, P>, reaction: Reaction<T>, pedestrian: Pedestrian<T, P, A>, targetSelectionStrategy: TargetSelectionStrategy<T, P>) : AbstractSteeringAction<T, P, A> , SteeringActionWithTarget<T, P>

A SteeringActionWithTarget in a vector space.

Link copied to clipboard
class AddJunctionInCell : AbstractNeighborAction<Double>
Represent the action of add a junction between the current node and a neighbor.
Link copied to clipboard
class AddJunctionInNeighbor<P : Position<out P>?> : AbstractNeighborAction<Double>
Represent the action of add a junction between a neighbor and the current node.
Link copied to clipboard
class BrownianMove<T, P : Position<P>?> : AbstractMoveNode<T, P>
Moves the node randomly.
Link copied to clipboard
class CameraInjectVisibleNodeClosestToDistance(node: Node<Any>, env: Physics2DEnvironment<Any>, distance: Double, visionMolecule: Molecule, targetMolecule: Molecule) : AbstractAction<Any>

Given a list of VisibleNode associated to visionMolecule, it finds the closest to a point located at distance from node in the direction of node's heading, and injects its position in targetMolecule.

Link copied to clipboard
class CameraSee @JvmOverloads constructor(node: Node<Any>, environment: Physics2DEnvironment<Any>, distance: Double, angle: Double, outputMolecule: Molecule, filterByMolecule: Molecule?) : AbstractAction<Any>

Checks nodes in the environment and writes in outputMolecule the list of it.unibo.alchemist.model.interfaces.VisibleNode, containing filterByMolecule. distance and angle define the field of view.

Link copied to clipboard
class CellMove<P : Position<P>?> : AbstractMoveNode<Double, P>
Link copied to clipboard
class CellTensionPolarization<P : Position2D<P>?> : AbstractAction<Double>
Link copied to clipboard
Link copied to clipboard
Action implementing the changing of the concentration of a given biomolecule in environment.
Link copied to clipboard
Link copied to clipboard
class ChemotacticPolarization<P : Position2D<P>?> : AbstractAction<Double>
Link copied to clipboard
open class CognitiveAgentArrive<T, P : Position<P>, Vector<P>, A : GeometricTransformation<P>>(env: Environment<T, P>, reaction: Reaction<T>, pedestrian: Pedestrian<T, P, A>, decelerationRadius: Double, arrivalTolerance: Double, target: P) : AbstractSteeringActionWithTarget<T, P, A>

Move the agent towards a target position. It is similar to CognitiveAgentSeek but attempts to arrive at the target position with a zero velocity.

Link copied to clipboard
class CognitiveAgentAvoidLayer @JvmOverloads constructor(environment: Euclidean2DEnvironment<Number>, reaction: Reaction<Number>, pedestrian: Pedestrian2D<Number>, targetMolecule: Molecule, viewDepth: Double) : AbstractLayerAction

Move the pedestrian towards positions of the environment with a low concentration of the target molecule.

Link copied to clipboard
class CognitiveAgentCohesion<T, P : Position<P>, Vector<P>, A : GeometricTransformation<P>>(env: Environment<T, P>, reaction: Reaction<T>, pedestrian: Pedestrian<T, P, A>) : AbstractGroupSteeringAction<T, P, A>

Move the agent towards the other members of his group.

Link copied to clipboard
class CognitiveAgentCombineSteering<T, P : Position<P>, Vector<P>, A : GeometricTransformation<P>>(env: Environment<T, P>, reaction: Reaction<T>, pedestrian: Pedestrian<T, P, A>, actions: List<SteeringAction<T, P>>, steerStrategy: SteeringStrategy<T, P>) : AbstractSteeringAction<T, P, A>

Combination of multiple steering actions.

Link copied to clipboard

A NavigationAction using Exploring navigation strategy.

Link copied to clipboard
open class CognitiveAgentFlee<T, P : Position<P>, Vector<P>, A : GeometricTransformation<P>>(env: Environment<T, P>, reaction: Reaction<T>, pedestrian: Pedestrian<T, P, A>, coords: Double) : AbstractSteeringAction<T, P, A>

Move the agent away from a target position. It's the opposite of CognitiveAgentSeek.

Link copied to clipboard
open class CognitiveAgentFollowLayer(env: Euclidean2DEnvironment<Number>, reaction: Reaction<Number>, pedestrian: Pedestrian2D<Number>, targetMolecule: Molecule) : AbstractLayerAction

Move the pedestrian towards positions of the environment with a high concentration of the target molecule.

Link copied to clipboard

A NavigationAction using RouteFollowing navigation strategy.

Link copied to clipboard
class CognitiveAgentFollowScalarField<T, P : Position2D<P>, Vector2D<P>, A : GeometricTransformation<P>>(env: Environment<T, P>, reaction: Reaction<T>, pedestrian: Pedestrian<T, P, A>, center: P?, valueIn: (P) -> Double) : AbstractSteeringAction<T, P, A>

Moves the pedestrian where the given scalar field is higher.

Link copied to clipboard
class CognitiveAgentGoalOrientedExplore<T, L : Euclidean2DConvexShape, R>(environment: Euclidean2DEnvironmentWithGraph<*, T, ConvexPolygon, Euclidean2DPassage>, reaction: Reaction<T>, pedestrian: OrientingPedestrian2D<T, L, R>, unknownDestinations: Number) : CognitiveAgentNavigationAction2D<T, L, R>

A NavigationAction using GoalOrientedExploring navigation strategy.

Link copied to clipboard

Implementation of a NavigationAction2D. This action accepts an Euclidean2DEnvironmentWithGraph whose graph contains ConvexPolygonal nodes and Euclidean2DPassages as edges.

Link copied to clipboard

Move the agent avoiding potential obstacles in its path.

Link copied to clipboard
class CognitiveAgentPursue<T, L : Euclidean2DConvexShape, R>(environment: Euclidean2DEnvironmentWithGraph<*, T, ConvexPolygon, Euclidean2DPassage>, reaction: Reaction<T>, pedestrian: OrientingPedestrian2D<T, L, R>, destination: Number) : CognitiveAgentNavigationAction2D<T, L, R>

A NavigationAction using Pursuing navigation strategy.

Link copied to clipboard

A NavigationAction using DestinationReaching navigation strategy. Accepts an array of coordinates representing the destinations and uses inferIsKnown to partition them into known and unknown ones.

Link copied to clipboard
Link copied to clipboard
open class CognitiveAgentSeek<T, P : Position<P>, Vector<P>, A : GeometricTransformation<P>>(environment: Environment<T, P>, reaction: Reaction<T>, pedestrian: Pedestrian<T, P, A>, target: P) : CognitiveAgentArrive<T, P, A>

Move the pedestrian towards the target position as fast as possible.

Link copied to clipboard
open class CognitiveAgentSeek2D<T, P : Position2D<P>, Vector2D<P>, A : GeometricTransformation<P>>(environment: EuclideanEnvironment<T, P>, reaction: Reaction<T>, pedestrian: Pedestrian<T, P, A>, target: P) : AbstractSteeringAction<T, P, A> , SteeringActionWithTarget<T, P>

CognitiveAgentSeek behavior in a bidimensional environment, delegated to CognitiveAgentFollowScalarField (this means the pedestrian tries to overtake others on its path, in general its movements are more sophisticated than CognitiveAgentSeek).

Link copied to clipboard

Move the agent away from the pedestrians near to him.

Link copied to clipboard
open class CognitiveAgentWander<T>(environment: Physics2DEnvironment<T>, reaction: Reaction<T>, pedestrian: Pedestrian2D<T>, randomGenerator: RandomGenerator, offset: Double, radius: Double) : AbstractSteeringActionWithTarget<T, Euclidean2DPosition, Euclidean2DTransformation>

Give the impression of a random walk through the environment targeting an ever changing pseudo-randomly point of a circumference at a given distance and with a given radius from the current pedestrian position.

Link copied to clipboard
class ConstantDistanceRandomWalk<T>(node: Node<T>, reaction: Reaction<T>, environment: Environment<T, Euclidean2DPosition>, randomGenerator: RandomGenerator, distance: Double, speed: Double) : GenericRandomWalker<T>

Moves for distance toward a uniformly random chosen direction at a constant speed, then changes direction and walks another distance, and so on.

Link copied to clipboard
class FollowAtDistance<T>(node: Node<T>, reaction: Reaction<T>, env: Environment<T, Euclidean2DPosition>, target: Molecule, distance: Double, speed: Double) : AbstractAction<T>

Makes the Node follow a target defined in a Molecule with some speed, but keeping a distance from it.

Link copied to clipboard
open class GenericRandomWalker<T>(node: Node<T>, reaction: Reaction<T>, environment: Environment<T, Euclidean2DPosition>, randomGenerator: RandomGenerator, speed: Double, distanceDistribution: RealDistribution) : AbstractEuclideanConfigurableMoveNode<T, Euclidean2DPosition>

Chooses random targets in a direction extracted from randomGenerator at a distance extracted from distanceDistribution. Moves the node towards the targets at the given constant speed. Changes target on collision.

Link copied to clipboard
class GPSTraceWalker<T, O : RoutingServiceOptions<O>?, S : RoutingService<GeoPosition, O>?> : MoveOnMapWithGPS<T, O, S>
A walker that follows a trace.
Link copied to clipboard
class HeadTowardRandomDirection<T>(node: Node<T>, environment: Physics2DEnvironment<T>, randomGenerator: RandomGenerator) : AbstractAction<T>

Changes the heading of node randomly. The environment must support node heading, hence, be a Physics2DEnvironment.

Link copied to clipboard
class HeadTowardTarget<T> @JvmOverloads constructor(node: Node<T>, environment: Physics2DEnvironment<T>, reaction: Reaction<T>, target: Molecule, angularSpeedDegrees: Double) : AbstractAction<T>

Reads the target's absolute coordinates from the target molecule contained in node and sets the node's heading accordingly.

Link copied to clipboard
class LevyWalk<T> @JvmOverloads constructor(node: Node<T>, reaction: Reaction<T>, environment: Environment<T, Euclidean2DPosition>, randomGenerator: RandomGenerator, speed: Double, scale: Double, shape: Double) : GenericRandomWalker<T>

Selects a target based on a random direction extracted from rng, and a random distance extracted from a ParetoDistribution of parameters scale and shape. Moves toward the targets at a constant speed and changes targets on collision.

Link copied to clipboard
abstract class LsaAbstractAction : AbstractAction<List<ILsaMolecule>> , ILsaAction
Link copied to clipboard
class LsaAllNeighborsAction : LsaRandomNeighborAction
The execution involves all neighbours.
Link copied to clipboard
class LsaAscendingAgent<P : Position2D<out P>?> : SAPEREMoveNodeAgent<P>
Link copied to clipboard
class LsaAscendingGradientDist<P : Position<P>?> : SAPERENeighborAgent<P>
Link copied to clipboard
class LsaChangeArgument : SAPERELocalAgent
Link copied to clipboard
class LsaCountNeighborsAction : SAPERELocalAgent
Link copied to clipboard
open class LsaRandomNeighborAction : LsaStandardAction
Link copied to clipboard
open class LsaStandardAction : LsaAbstractAction
This action add LsaMolecule in a single node.
Link copied to clipboard
class MoveForwardAndTeleport<T, P : Position2D<P>?> : AbstractMoveNode<T, P>
Moves the node along the x axis up to coordinate getMaxX, with steps of size getDeltaX.
Link copied to clipboard
Link copied to clipboard
open class MoveOnMapWithGPS<T, O : RoutingServiceOptions<O>?, S : RoutingService<GeoPosition, O>?> : MoveOnMap<T, O, S>
basic action that follow a GPSTrace.
Link copied to clipboard
class MoveToTarget<T, P : Position2D<P>?> : AbstractConfigurableMoveNode<T, P>
Movement towards a target defined as a concentration.
Link copied to clipboard
class RandomPolarization<P : Position2D<P>?> : AbstractRandomizableAction<Double>
Link copied to clipboard
class RandomTargetInPolygonOnMap<T, O : RoutingServiceOptions<O>, S : RoutingService<GeoPosition, O>>(environment: MapEnvironment<T, O, S>, node: Node<T>, reaction: Reaction<T>, speed: Double, positionGenerator: Polygon<GeoPosition>) : MoveOnMap<T, O, S>

This actions generates random waypoints inside a Polygon. The polygon can be provided either through as a deployment (positionGenerator), or as List<List<Number>> (polygonCoordinates)

Link copied to clipboard
class RemoveJunctionInCell : AbstractNeighborAction<Double>
Represent the action of removing a junction between the current node and a neighbor.
Link copied to clipboard
class RemoveJunctionInNeighbor : AbstractNeighborAction<Double>
Represent the action of removing a junction between a neighbor and the current node.
Link copied to clipboard
class RemoveNode<T> : AbstractAction<T>
Removes the current node from the environment.
Link copied to clipboard
open class ReproduceGPSTrace<T, O : RoutingServiceOptions<O>?, S : RoutingService<GeoPosition, O>?> : MoveOnMapWithGPS<T, O, S>
Link copied to clipboard
class RunProtelisProgram<P : Position<P>?> : Action<Any>
Link copied to clipboard
abstract class SAPEREAgent : LsaAbstractAction
Link copied to clipboard
class SAPEREChemotaxis<P : Position<P>?> : SAPERENeighborAgent<P>
This class provides a chemotaxis implementation for SAPERE, namely, an agent able to move a molecule towards a specific node.
Link copied to clipboard
abstract class SAPERELocalAgent : SAPEREAgent
A SAPERE Agent that does not do actions on neighbors.
Link copied to clipboard
class SAPEREMoveLSAToAgent : SAPEREAgent
This agent matches a template, removes a single instance of it from the current node and moves the LSA to another node (specified at creation time).
Link copied to clipboard
abstract class SAPEREMoveNodeAgent<P : Position<out P>?> : SAPERELocalAgent
Link copied to clipboard
abstract class SAPERENeighborAgent<P : Position<P>?> : SAPEREAgent
A SAPERE Agent that modifies something on neighboring nodes.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class SendToNeighbor : AbstractAction<Any>
Link copied to clipboard
class SetLocalMoleculeConcentration<T> : AbstractActionOnSingleMolecule<T>
Link copied to clipboard
class Spin<T>(node: Node<T>, reaction: Reaction<T>, env: Physics2DEnvironment<T>, angularSpeedDegrees: Double) : AbstractAction<T>

Spins a node around itself at angularSpeedDegrees normalized according to the speed of the reaction.

Link copied to clipboard
open class TargetMapWalker<T, O : RoutingServiceOptions<O>?, S : RoutingService<GeoPosition, O>?> : MoveOnMap<T, O, S>
Link copied to clipboard
open class ToggleMolecule<T>(node: Node<T>, molecule: Molecule, concentration: T) : AbstractAction<T>

Treats molecule as a switch:

Link copied to clipboard
open class ToggleMoleculeRandomly<T>(node: Node<T>, randomGenerator: RandomGenerator, molecule: Molecule, concentration: T, odds: Double) : ToggleMolecule<T>

Treats molecule as a probabilistic switch:

Functions

Link copied to clipboard
fun <T> Sequence<T>.cartesianProduct(other: Sequence<T>): Sequence<Pair<T, T>>

Performs the cartesian product of two sequences.

Link copied to clipboard
fun <T> List<T>.takePercentage(percentage: Double): List<T>

Takes the first percentage * size elements of the list.

Link copied to clipboard
fun <P : Position<P>> Array<out Number>.toPositions(environment: Environment<*, P>): List<P>

Converts an array of numbers representing positions to an actual list of positions. E.g. the array 2,3,4,5 in a bidimensional environment would be transformed into a list containing positions (2,3) and (4,5).