Hide Comments
Hide Comments

Comments (0)

Defines the floating point node for tree-based genetic programming which can contain at most 2 children. Each node represents one function or terminal (constant, variable) in a genetic program. It has one  Parent (or nil if root node) and 0 or more  Child nodes (terminals have no children).

noteNote

If your instructions have arity greater than 2, use the RSGeneticProgramming.TRSGPFloatNode class instead.

alert_noteNotes to Implementers

The TRSGPBinaryFloatNode class was created so that LoadValueFromXML. SaveValueToXML. amd ValueToString methods could be defined (using FloatToStr and StrToFloat).

Namespace: RSGeneticProgramming

expandingInheritance Hierarchy

TPersistent
  RSGenerics.GeneticProgramEngine.TRSGPNode<T>
    RSGenerics.GeneticProgramEngine.TRSGPBinaryNode<T>
      RSGeneticProgramming.TRSGPBinaryFloatNode
 

expandingSyntax

Delphi

type
  TRSGPBinaryFloatNode = class(TRSGPBinaryNode<TGAFloat>)
  end; 
 

expandingConstructors

 

Name

Description

public constructor

Create(TRSGPInstruction<T>,TRSGPNode<T>)

Creates the node and assigns values to its   Instruction and   Parent properties (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

Top

expandingProperties

 

Name

Description

public property

ChildCount

Returns the number of children that the node contains (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public property

Child[Integer]

Returns the child node at the specified index (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public property

Instruction

Specifies the Instruction (function, variable or constant) that this node represents in the genetic program (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public property

Left

Specifies the left child (or Child[0]) for the current node. Assigning a value to this property will free the current Left child node. (Inherited from RSGenerics.GeneticProgramEngine.TRSGPBinaryNode<T>.)

public property

Parent

Specifies the Parent node of the current node (or nil if there is no parent) (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public property

Right

Specifies the right child (or Child[1]) for the current node. Assigning a value to this property will free the current Right child node. (Inherited from RSGenerics.GeneticProgramEngine.TRSGPBinaryNode<T>.)

public property

Value

Specifies the constant value of the node. If the node is not a constant, this value will be ignored (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

Top

expandingMethods

 

Name

Description

public method

AddChild(TRSGPNode<T>)

Represents method AddChild(TRSGPNode<T>). (Inherited from RSGenerics.GeneticProgramEngine.TRSGPBinaryNode<T>.)

public method

Assign(TPersistent)

Makes a deep copy (i.e., all children, grandchildren, etc) of the Source to the node (Overrides RSGenerics.GeneticProgramEngine.TRSGPNode<T>.Assign(TPersistent).)

protected method

CalcDepth

Calculate the depth of the tree with this node as the parent (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

protected method

CalcSize

Calculate the size of the tree with this node as the parent (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public method

Clear

Empties the node of all information (i.e.,   Instruction equals nil,   Value equals default, and children are deleted and freed) (Overrides RSGenerics.GeneticProgramEngine.TRSGPNode<T>.Clear.)

public method

Clone(TRSGPNode<T>)

Creates a copy of the current node and all of its children. This is a deep copy of the entire subtree. (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

protected method

CreateNode(TRSGPInstruction<TGAFloat>,TRSGPNode<TGAFloat>)

Represents method CreateNode(TRSGPInstruction<TGAFloat>,TRSGPNode<TGAFloat>). (Overrides RSGenerics.GeneticProgramEngine.TRSGPBinaryNode<T>.CreateNode(TRSGPInstruction<T>,TRSGPNode<T>).)

public method

Depth

Returns the depth (maximum number of levels of children) of the subtree with this node as its root. If the node has no children, the depth is 1. If the node has children, its depth is 2. If at least one of its children has children, the depth is 3, etc. (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public method

Execute(TRSGPContext<T>)

Executes the current node using the specified Context.

Note that it is up to the Instruction to do the actual execution in its     OnExecute event. The instruction is also where the decision to execute children event or not is made.

public method

ExtractChild(TRSGPNode<T>)

Represents method ExtractChild(TRSGPNode<T>). (Inherited from RSGenerics.GeneticProgramEngine.TRSGPBinaryNode<T>.)

protected method

GetChild(Integer)

Represents method GetChild(Integer). (Overrides RSGenerics.GeneticProgramEngine.TRSGPNode<T>.GetChild(Integer).)

protected method

GetChildCount

Represents method GetChildCount. (Overrides RSGenerics.GeneticProgramEngine.TRSGPNode<T>.GetChildCount.)

public method

IndexOf(TRSGPNode<T>)

Searchs for the Node as a child of the current node. If the node is found, this method returns the index to access the child. Otherwise, it returns -1. (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public method

InsertChild(Integer,TRSGPNode<T>)

Represents method InsertChild(Integer,TRSGPNode<T>). (Inherited from RSGenerics.GeneticProgramEngine.TRSGPBinaryNode<T>.)

public method

IsTerminal

Returns true if the node is a terminal (constant, variable, or function with arity of 0) (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public method

LoadFromXML(IXMLDnaType)

Loads the node and its children from the XML (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public method

LoadValueFromXML(IXMLDnaType)

Loads the   Value from the XML (Overrides RSGenerics.GeneticProgramEngine.TRSGPNode<T>.LoadValueFromXML(IXMLDnaType).)

protected method

Modified

Represents method Modified. (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public method

SaveToXML(IXMLDnaType)

Saves the node and its children to the XML (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public method

SaveValueToXML(IXMLDnaType)

Saves the   Value to the XML (Overrides RSGenerics.GeneticProgramEngine.TRSGPNode<T>.SaveValueToXML(IXMLDnaType).)

protected method

SetValue(T)

Represents method SetValue(T). (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public method

Size

Returns the size (how many children, grandchildren, etc) of the subtree with this node as its root. If the node has no children, the depth is 1. (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public method

ToString

Returns a prefix notation version of the node and its children (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

public method

ValueToString

Returns a string representation of the   Value. (Overrides RSGenerics.GeneticProgramEngine.TRSGPNode<T>.ValueToString.)

Top

expandingFields

 

Name

Description

protected field

FDepth

Represents field FDepth. (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

protected field

FSize

Represents field FSize. (Inherited from RSGenerics.GeneticProgramEngine.TRSGPNode<T>.)

Top

expandingSee Also

Comments (0)