| Description | Hierarchy | Fields | Methods | Properties |
type TBehavior = class(TTenaciousObject)
Base class for all behaviors.
| Name | Description | |
|---|---|---|
![]() |
fAccumulatedTime |
Total time (in seconds) that the behavior has been active. |
![]() |
fActive |
Indicates whether the behavior is currently active. This property is set to |
![]() |
fBehaviorList |
Container of sub-behaviors. This is the key element for enabling behavioral hierarchies. |
![]() |
fBehaviorTime |
Time (in seconds) since the last activation. This variable is set to zero when the procedure Enter is called. See also AccumulatedTime. |
![]() |
fInputVariables |
Container class for TVariables containing the input variables (TInputVariables). Input variables are defined in the robot definition file (in the definition of the brain) and are variables needed by the behavior (for internal calculations etc.). |
![]() |
fLevel |
Hierarchical level of the behavior. |
![]() |
fStateVariables |
Container class for TVariables containing the state variables (TStateVariables). State variables are defined in the robot definition file (in the definition of the brain) and are the variables that are used as inputs to the behavior's utility function (UtilityFunction). |
![]() |
fUtility |
The behavior's utility value (as generated by fUtilityFunction). |
![]() |
fUtilityFunction |
The behavior's utility function (currently restricted to be in the form of a polynomial function). |
![]() |
constructor Create; override; |
![]() |
constructor CreateAndSet(B: TBehavior); virtual; |
![]() |
destructor Destroy; override; |
![]() |
procedure AddAsStrings(Strings: TStringList); |
![]() |
procedure AddUtilityFunctionsAsStrings(Strings: TStringList); |
![]() |
procedure AppendUtilityValuesToVector(UtilityVector: TVector); |
![]() |
function Copy: TBehavior; virtual; |
![]() |
procedure Enter; virtual; |
![]() |
procedure Exit; virtual; |
![]() |
procedure FindActive(var ActiveID: TIntegerVector; ActiveBehaviorHierarchyPath: TObjectContainer); |
![]() |
procedure GenerateRandomUMGenes(Genome: TGenome; Degree: integer; CoefficientRange: real); |
![]() |
function GetActive(ActiveID: TIntegerVector; var CurrentLevel: integer): TBehavior; |
![]() |
procedure Initialize(Sensors: TSensors; Hormones: THormones); virtual; |
![]() |
procedure LoadFromDefinition(ObjDef: TObjectDefinition); virtual; |
![]() |
procedure SetLevel(Level: integer); |
![]() |
procedure SetUtilityFunction(UtilityFunction: TMathematicalFunction); |
![]() |
procedure SetUtilityFunctionFromGenome(Genome: TGenome; var index: integer); |
![]() |
procedure Step(TimeStep: real); virtual; |
![]() |
procedure UpdateUtility; |
![]() |
constructor Create; override; |
Constructor
![]() |
constructor CreateAndSet(B: TBehavior); virtual; |
Copy constructor. Copies all properties of B and then sets BehaviorTime and AccumulatedTime to zero.
![]() |
destructor Destroy; override; |
Destructor
![]() |
procedure AddAsStrings(Strings: TStringList); |
Adds the name of the behavior (and any sub-behaviors) as string to a list of strings. Plus signs ("+") are prepended to the name of the behavior to indicate the behavior's hierarchical level. This procedure is called by TBrain.HierarchyAsStrings.
![]() |
procedure AddUtilityFunctionsAsStrings(Strings: TStringList); |
Adds all utility functions (including sub-behaviors) as strings to a list of strings. Hierarchical level is indicated by prepending space characters. For clarity, the name of the behavior is appended to the utility function. This procedure is called by TBrain.UtilityFunctionsAsStrings.
![]() |
procedure AppendUtilityValuesToVector(UtilityVector: TVector); |
Appends the current values of the utility functions (entire hierarchy) to the supplied vector. This procedure is called by TBrain.GetUtilityValuesAsVector.
![]() |
function Copy: TBehavior; virtual; |
Creates a copy of the behavior by calling the copy constructor CreateAndSet.
A copy of the behavior.
![]() |
procedure Enter; virtual; |
Procedure called when the behavior is activated. Main purpose of this procedure is to set BehaviorTime to zero and set the property Active to True.
![]() |
procedure Exit; virtual; |
Procedure called when the behavior is de-activated (occurs when another behavior is activated). This procedure sets the property Active to False and updates the variable AccumulatedTime by adding the value of BehaviorTime.
![]() |
procedure FindActive(var ActiveID: TIntegerVector; ActiveBehaviorHierarchyPath: TObjectContainer); |
Recursive procedure for finding the behavior that is active (or the entire path of behaviors in case of a hierarchical structure of behaviors). This procedure is used by TBrain and should not be called explicitly. Instead, use the property TBrain.ActiveBehavior to get the active behavior during run-time.
![]() |
procedure GenerateRandomUMGenes(Genome: TGenome; Degree: integer; CoefficientRange: real); |
Generates random utility functions for this behavior and any sub-behaviors. This procedure is called by TBrain.GenerateRandomGenome.
![]() |
function GetActive(ActiveID: TIntegerVector; var CurrentLevel: integer): TBehavior; |
Recursive procedure that returns the active behavior. This procedure is called by TBrain.GetActiveBehavior (use this procedure to get the active behavior).
The currently active behavior.
![]() |
procedure Initialize(Sensors: TSensors; Hormones: THormones); virtual; |
Initialization of the behavior. The main purpose of this procedure is to map all input and state variables. This procedure is called automatically by TBrain.Initialize and does not need to be called explicitly.
![]() |
procedure LoadFromDefinition(ObjDef: TObjectDefinition); virtual; |
Procedure for processing the definition of a behavior (as parsed from the definition text file). This procedure is automatically called from TBehaviorList.LoadFromDefinition and does not need to be called explicitly.
![]() |
procedure SetLevel(Level: integer); |
Sets the hierarchical level of the behavior (sets the value of fLevel).
![]() |
procedure SetUtilityFunction(UtilityFunction: TMathematicalFunction); |
Sets the behavior's utility function. (Currently, only polynomial functions are supported.) Before creating a copy of UtilityFunction, the existing function is destroyed. The user is responsible for freeing the space allocated by UtilityFunction.
![]() |
procedure SetUtilityFunctionFromGenome(Genome: TGenome; var index: integer); |
Sets the utility function by extracting polynomial function from the genome (see TUMGene) and calling SetUtilityFunction. This procedure is called by TRobot.DecodeGenome and does not need to be called explicitly.
SetUtilityFunctionFromGenome.![]() |
procedure Step(TimeStep: real); virtual; |
Procedure called in every time step. Currently, this procedure only updates the property BehaviorTime by adding the value of TimeStep. This procedure is called in TBrain.Step and does not need to be called explicitly.
![]() |
procedure UpdateUtility; |
Procedure that updates the utility value (fUtility) by evaluating the utility function (any sub-behaviors are also updated). Before evaluating the utility function, all relevant state variables (fStateVariables) are updated as well (see TExternalVariable.Update).
![]() |
property AccumulatedTime: real; |
![]() |
property Active: Boolean; |
![]() |
property BehaviorList: TBehaviorList; |
![]() |
property BehaviorTime: real; |
![]() |
property InputVariables: TInputVariables; |
![]() |
property Level: integer; |
![]() |
property StateVariables: TStateVariables; |
![]() |
property Utility: real; |
![]() |
property UtilityFunction: TMathematicalFunction; |
![]() |
property AccumulatedTime: real; |
Provides read access to the protected variable fAccumulatedTime.
![]() |
property Active: Boolean; |
Provides read access to the protected variable fActive.
![]() |
property BehaviorList: TBehaviorList; |
Provides read access to the protected variable fBehaviorList.
![]() |
property BehaviorTime: real; |
Provides read access to the protected variable fBehaviorTime.
![]() |
property InputVariables: TInputVariables; |
Provides read access to fInputVariables.
![]() |
property Level: integer; |
Provides read access to fLevel.
![]() |
property StateVariables: TStateVariables; |
Provides read access to fStateVariables.
![]() |
property Utility: real; |
Provides read access to fUtility.
![]() |
property UtilityFunction: TMathematicalFunction; |
Provides read access to fUtilityFunction.