Class TAgent

DescriptionHierarchyFieldsMethodsProperties

Unit

Agent

Declaration

type TAgent = class(TTenaciousObject)

Description

Abstract base class whose main purpose is to provide the basic interface to the evolutionary algorithm (see TEA and TPopulation). Currently there is only one concrete class implementing the interface of TAgent, namely TRobot.

When implementing a specific class by deriving from TAgent, be sure to implement all methods in TAgent.

Hierarchy

TAgent > TTenaciousObject > TPersistent

Fields

 NameDescription
Protected fGenome

A member variable containing the agent's genome. This is the hart of the agent.

Protected fTime

Variable holding the actual simulation time of an agent.

Methods

Overview

Public constructor Create; virtual;
Public constructor CreateAndSet(Agent: TAgent); virtual;
Public destructor Destroy; override;
Public function Copy: TAgent; virtual;
Public procedure DecodeGenome; virtual; abstract;
Public procedure Initialize; virtual; abstract;
Public procedure Move(TimeStep: real; const Arena: TArena); virtual; abstract;
Public procedure Mutate(MutationParameters: TMutationParameters); virtual; abstract;

Description

Public constructor Create; virtual;

Default constructor. By default, this constructor creates the member variable fGenome (also, see the Genome property).

Public constructor CreateAndSet(Agent: TAgent); virtual;

Copy constructor. The copy constructor copies everything except the protected variable fTime which is always initialized to zero when creating a new object.

Public destructor Destroy; override;

Default destructor. Be sure to call the inherited destructor in any dervied classes in order to avoid memory leaks. The main purpose of this destructor is to free the member fGenome by calling its destructor TGenome.Destroy.

Public function Copy: TAgent; virtual;

Creates a copy by calling the copy constructor CreateAndSet.

Public procedure DecodeGenome; virtual; abstract;

Procedure responsible for decoding the member variable Genome. This procedure must be defined by the user in order to decode the Genome into something useful (such as e.g. an artificial neural network or a behavioral organizer).

Public procedure Initialize; virtual; abstract;

Abstract procedure that can be used for initialization of variables prior to evaluation.

Public procedure Move(TimeStep: real; const Arena: TArena); virtual; abstract;

Procedure called every time step and closely connected to the dynamics of an agent. This procedure can be used for calculating properties that needs updating every time step. Such calculations could be the integration of the equations of motion, updating sensors, or checking for collisions (see TDifferentiallySteeredBody.Move for a concrete example).

Public procedure Mutate(MutationParameters: TMutationParameters); virtual; abstract;

Abstract procedure for performing a mutation of the agent's genome (fGenome). This procedure must be implemented in descendant classes.

Properties

Overview

Public property CrossoverDefined: Boolean;
Public property Fitness: real;
Public property Genome: TGenome;
Public property RankedFitness: real;
Public property SubPopulationIndex: integer;
Public property Time: real;

Description

Public property CrossoverDefined: Boolean;

Boolean property that indicates wether a crossover operator is defined for this object or not. Returns True if the crossover operator exists and False otherwise (default state is False).

Public property Fitness: real;

Property containing the fitness of an agent (as assigned during evaluation).

Public property Genome: TGenome;

See the variable fGenome.

Public property RankedFitness: real;

Currently not used.

Public property SubPopulationIndex: integer;

Currently not used.

Public property Time: real;

See variable fTime.


Generated by PasDoc 0.8.8.3 on 2005-05-28 08:13:48