C# Класс SharpNeat.Domains.PreyCapture.PreyCaptureWorld

The prey capture task's grid world. Encapsulates agent's sensor and motor hardware and the prey's simple stochastic movement.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
InitPositions ( ) : void

Initialise agent and prey positions. The prey is positioned randomly with at least 4 empty squares between it and a wall (in all directions). The agent is positioned randomly but such that the prey is within sensor range (distance 2 or less).

IsPreyCaptured ( ) : bool

Gets a boolean that indicates if the prey has been captured.

MoveAgent ( IBlackBox agent ) : void

Allow the agent to move one square based on its decision. Note that the agent can choose to not move.

MovePrey ( ) : void

Move the prey. The prey moves by a simple set of stochastic rules that make it more likely to move away from the agent, and more so when it is close.

PreyCaptureWorld ( int gridSize, int preyInitMoves, double preySpeed, double sensorRange, int maxTimesteps ) : System

Constructs with the provided world parameter arguments.

RunTrial ( IBlackBox agent ) : bool

Runs one trial of the provided agent in the world. Returns true if the agent captures the prey within the maximum number of timesteps allowed.

SetAgentInputsAndActivate ( IBlackBox agent ) : void

Determine the agent's position in the world relative to the prey and walls, and set its sensor inputs accordingly.

Приватные методы

Метод Описание
CalcAngleDelta ( double a, double b ) : double

Calculates minimum angle between two vectors (specified by angle only).

MovePrey_T ( double distance ) : double

Описание методов

InitPositions() публичный Метод

Initialise agent and prey positions. The prey is positioned randomly with at least 4 empty squares between it and a wall (in all directions). The agent is positioned randomly but such that the prey is within sensor range (distance 2 or less).
public InitPositions ( ) : void
Результат void

IsPreyCaptured() публичный Метод

Gets a boolean that indicates if the prey has been captured.
public IsPreyCaptured ( ) : bool
Результат bool

MoveAgent() публичный Метод

Allow the agent to move one square based on its decision. Note that the agent can choose to not move.
public MoveAgent ( IBlackBox agent ) : void
agent IBlackBox
Результат void

MovePrey() публичный Метод

Move the prey. The prey moves by a simple set of stochastic rules that make it more likely to move away from the agent, and more so when it is close.
public MovePrey ( ) : void
Результат void

PreyCaptureWorld() публичный Метод

Constructs with the provided world parameter arguments.
public PreyCaptureWorld ( int gridSize, int preyInitMoves, double preySpeed, double sensorRange, int maxTimesteps ) : System
gridSize int
preyInitMoves int
preySpeed double
sensorRange double
maxTimesteps int
Результат System

RunTrial() публичный Метод

Runs one trial of the provided agent in the world. Returns true if the agent captures the prey within the maximum number of timesteps allowed.
public RunTrial ( IBlackBox agent ) : bool
agent IBlackBox
Результат bool

SetAgentInputsAndActivate() публичный Метод

Determine the agent's position in the world relative to the prey and walls, and set its sensor inputs accordingly.
public SetAgentInputsAndActivate ( IBlackBox agent ) : void
agent IBlackBox
Результат void