Random walk in 2D space based on agent angle orientation and step distance

An implementation of random walk in Python, which defines an agent class `Walker` capable of random walk movement based on random angle and movement step distance in a continuous 2D space.

1
contributor

What Random walk in 2D space based on agent angle orientation and step distance can do for you

An implementation of random walk in Python, which defines an agent class Walker capable of random walk movement based on random angle and movement step distance in a continuous 2D space.

Inputs

NameTypeDescription
worldDimensionsdictionary (Dict)The 2D world dimensions or limits. Specifically, the minimum and maximum coordinates in x and y that are considered valid positions in space. It is a dictionary with 'x' and 'y' keys, each associated to a two-item tupple of floats, representing minimum and maximum coordinates; e.g. {'x':(-50,50), 'y':(-50,50)}
angleLeftMax, angleRightMaxfloatLeft and right angles in relation to an agent current angular direction that mark the maximum range of stochastic variation in direction for a step in a random walks. Both values must be set within the 0-180 interval. If both are set to 180, the direction of the previous step will have no impact on the direction of the next step (i.e. angle will be sampled from a 0-360 degrees interval).
moveDistanceMin, moveDistanceMaxfloatMinimum and maximum distance travelled after a step. When moveDistanceMin is less than moveDistanceMax, these mark the maximum range of stochastic variation in distance per step. If these are equal, distance travelled per step will be constant. MoveDistanceMin must be a positive number equal to or less than MoveDistanceMin. MoveDistanceMin must be a positive number equal to or greater than MoveDistanceMin, but less than the maximum world distance set by worldDimensions.
(initial) x, yfloatInitial x and y coordinates of the agent's position.

Outputs

NameTypeDescription
positionX, positionYfloatThe agent's position in x and y coordinates within the 2D space set by worldDimensions.
directionfloatThe agent's angular direction in degrees.
Language
  • Python
Modelling
  • agent behaviour (self)
Module type
  • Algorithm
Programming
  • Nondeterministic
  • Object-oriented
Subject
  • random walk
Keywords
No keywords available
License
</>Source code

Contributors

AA
Andreas Angourakis

Member of community

NASSA