Hide Comments
Hide Comments

Comments (0)

Defines one instruction (function, variable, or constant) in the genetic program.

noteNote

When the instruction executes, it needs no information beyond the nodes and the values passed in, so it may be multi-threaded as long as the values are copied and unless the OnExecute event does something unsafe.

Namespace: RSGenerics.GeneticProgramEngine

expandingInheritance Hierarchy

TCollectionItem
  RSGenerics.GeneticProgramEngine.TRSGPInstruction<T>
    RSGeneticProgramming.TRSGPFloatInstruction
    RSGeneticProgramming.TRSGPVariantInstruction
 

expandingSyntax

Delphi

type 
  TRSGPInstruction<T> = class(TCollectionItem) 
  end;  
 

Type Parameters

T

expandingProperties

 

Name

Description

published property

Arity

Specifies the Arity (maximum allowed number of children) for the instruction. If Arity is greater than 0, the instruction must be a function

public property

Collection

Specifies the set of instructions that this instruction belongs to

published property

Comment

Specifies a comment about the instruction. This property is not used by the genetic programming engine (except for reading and writing the comment).

Use this property for describing the instruction and what it does or means

published property

Name

Specifies the name of the instruction

public property

OnExecute

Occurs when the instruction is executed. Define an OnExecute event handler for every instruction which is a function

published property

OnInitialize

Occurs when the instruction is initialized at the start of evolution. Use this event to seed the initial constant   Value for the instruction.

published property

Operation

Specifies the type of the instruction: function, variable or constant

public property

Value

Specifies the initial constant value for this instruction (if it is a constant).

noteNote

Initially, any TRSGPNode<T> created from this instruction will contain the Value constant. However, because of mutation, the node's Value can change. The Instruction Value should never change except at initialization

Top

expandingMethods

 

Name

Description

public method

Assign(TPersistent)

Represents method Assign(TPersistent).

public method

AssignEvents(TPersistent)

Copies the event handlers in the Source object to the instructions events

protected method

DoExecute(TRSGPNode<T>,TRSGPContext<T>)

Represents method DoExecute(TRSGPNode<T>,TRSGPContext<T>).

public method

Execute(TRSGPNode<T>,TRSGPContext<T>)

Executes the node using the specified context. The node provides information about the constant value (if the instruction is a constant) and the subtree program of the node. The Context provides program state information (including variable values).

The function returns a value of type T (which is the result of the OnExecute event, the Node.Value if it is a constant, or the variable value from the Context if is a variable)

protected method

GetDisplayName

Represents method GetDisplayName.

public method

Initialize

Initializes the instruction at the start of the genetic evolution (not the start of executing a genetic program). The function calls the OnInitialize event.

The intent of the Initialize method is to initialize the instruction for evolution; usually, this means provide an initial constant     Value.

public method

LoadFromXML(IXMLInstructionType)

Loads the instruction from the XML

alert_cautionWarning

If the instruction is a function, the OnExecute event is not loaded or changed

public method

LoadValueFromXML(IXMLInstructionType)

Loads the   Value from the XML

protected method

OperationChanged

Represents method OperationChanged.

public method

SaveToXML(IXMLConstantInstructionType)

Overloaded. Saves the instruction as a constant to the XML

public method

SaveToXML(IXMLFunctionInstructionType)

Overloaded. Saves the instruction as a function to the XML

alert_cautionWarning

If the instruction is a function, the OnExecute event is not saved

public method

SaveToXML(IXMLGPInstructions)

Overloaded. Saves the Instruction to the XML as a function, variable or constant based on its   Operation

public method

SaveToXML(IXMLVariableInstructionType)

Overloaded. Saves the instruction as a variable to the XML

public method

SaveValueToXML(IXMLInstructionType)

Saves the   Value to the XML

public method

ToString

Returns string representation of the instruction

Top

expandingSee Also

Comments (0)