next up previous contents
Next: Class: Population Up: Class: Individual Previous: Methods   Contents

Subsections

Attributes & Variables


NodeMutationProb

Data type: NUMBER
Default: 1/100
Defined in: GeneticProgram.pm
Mainly used in: mutate()
See also:

The probability that each node in the genome-tree will be subjected to mutation (see mutate()).


FixedMutations

Data type: NUMBER
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: mutate()
See also: FixedMutationProb

If non-zero, then a fixed number of mutations (equal to FixedMutations) will be attempted, regardless of genome size. This attribute overrides any setting of NodeMutationProb.


FixedMutationProb

Data type: NUMBER
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: mutate()
See also: FixedMutations

The probability with which FixedMutations will be performed. A setting of 0.1 would mean that 10% of the offspring from crossover are mutated.


PointMutationFrac

Data type: NUMBER
Default: 0.7
Defined in: GeneticProgram.pm
Mainly used in: mutate()
See also:

A mutation is either a point mutation or a macro mutation, this attribute controls how much of either. A setting of 1 means all point mutation and 0 means all macro mutation.


NumericMutationFrac

Data type: NUMBER
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: point_mutate()
See also: NumericIgnoreNTypes, NumericAllowNTypes, NumericMutationRegex

With this probability, point mutations on numbers (satisfying NumericMutationRegex) will be altered instead of replaced.


NumericMutationRegex

Data type: REGEX
Default: qr/^[+-]?\d+(?:\.\d+)?([eE][+-]?\d+)?$/
Defined in: GeneticProgram.pm
Mainly used in: point_mutate()
See also: NumericMutationFrac, NumericIgnoreNTypes, NumericAllowNTypes

Numeric mutations will only be done if this pattern matches the terminal node contents.


NumericIgnoreNTypes

Data type: HASH-REF
Default: empty
Defined in: GeneticProgram.pm
Mainly used in: point_mutate()
See also: NumericAllowNTypes()

Define the keys in this hash as the nodetypes you don't want to be numerically mutated, for example:

  NumericAllowNTypes => { ANGLE => 1, INDEX => 1 },

By default, all other terminals which match NumericMutationRegex will be mutated, with the default change factor of 0.1 (see NumericAllowNTypes).


NumericAllowNTypes

Data type: HASH-REF
Default: empty
Defined in: GeneticProgram.pm
Mainly used in: point_mutate()
See also: NumericIgnoreNTypes()

Define the keys in this hash as the nodetypes you want to be numerically mutated, for example:

  NumericAllowNTypes => { NUM => 1, CONST => 2 },

Where the values indicate how much change occurs on mutation. The change is calculated as:

  if (rand(1)<0.5) {
    $num *= (1 + $changefactor);
  } else {
    $num /= (1 + $changefactor);
  }

where $changefactor is the value given in your hash.


NoNeutralMutations

Data type: BOOLEAN
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: mutate()
See also:

If true, mutations will be repeated until a visible change in the program code is observed. This involves tree expansion and is therefore not very efficient. Effects not properly benchmarked.


PointMutationDepthBias

Data type: NUMBER
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: point_mutate()
See also: MacroMutationDepthBias, XoverDepthBias

Depth bias for point mutation node sampling. See _random_node() for details. The default of 0 means no bias at all (and so terminal nodes are relatively likely).


MacroMutationDepthBias

Data type: NUMBER
Default: 0.7
Defined in: GeneticProgram.pm
Mainly used in: point_mutate()
See also: PointMutationDepthBias, XoverDepthBias

Depth bias for macro mutation node sampling. See _random_node() for details.


MacroMutationTypes

Data type: ARRAY-REF
Default: see below
Defined in: GeneticProgram.pm
Mainly used in: macro_mutate()
See also:

This array contains the names of the macro mutation operators which may be used. An example of a name is swap_subtrees (do not include the () which is used in this manual for purposes of clarity only). Choice of operator is done in macro_mutate() by random sampling, so if you want to bias a certain operator, include its name in this array more than once.

The default array contains a single copy each of: swap_subtrees copy_subtree replace_subtree insert_internal delete_internal

Note that encapsulate_subtree and point_mutate_deep are not included by default.


EncapsulateIgnoreNTypes

Data type: HASH-REF
Default: empty
Defined in: GeneticProgram.pm
Mainly used in: encapsulate_subtree()
See also: EncapsulateFracMax

Don't allow these nodetypes (the keys in the hash) to be encapsulated. The values are not used. Example definition:

  EncapsulateIgnoreNTypes => { ADF => 1 },


EncapsulateFracMax

Data type: NUMBER
Default: 0.25
Defined in: GeneticProgram.pm
Mainly used in: encapsulate_subtree()
See also:

During node sampling in encapsulate_subtree(), subtrees are skipped if they contain more than EncapsulateFracMax of the total nodes in the tree. This is intended to prevent too much of a program being encapsulated. Not benchmarked!


UseEncapsTerminalsFrac

Data type: NUMBER
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: _random_function()
See also:

The probability that an already encapsulated subtree will be used instead of a function, during new subtree growth. Not benchmarked!


MutationLogFile

Data type: STRING
Default: `results/mutation.log'
Defined in: GeneticProgram.pm
Mainly used in: mutate()
See also: MutationLogProb

The filename for the mutation log. Relative to the experiment directory.


MutationLogProb

Data type: NUMBER
Default: 0.02
Defined in: GeneticProgram.pm
Mainly used in: mutate()
See also: MutationLogFile

The probability with which a log entry is written to MutationLogFile.


NodeXoverProb

Data type: NUMBER
Default: 1/50
Defined in: GeneticProgram.pm
Mainly used in: crossover()
See also: FixedXovers, FixedXoverProb

The per node crossover point selection probability.


FixedXovers

Data type: NUMBER
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: crossover()
See also: FixedXoverProb

If non-zero, then a fixed number of crossover points (equal to FixedXovers) will be attempted, regardless of genome size. This attribute overrides any setting of NodeXoverProb.


FixedXoverProb

Data type: NUMBER
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: crossover()
See also: FixedXovers

The probability with which FixedXovers crossover points will be attempted during reproduction (otherwise no crossovers will be attempted, which is the same as asexual reproduction).


XoverDepthBias

Data type: NUMBER
Default: 0.1
Defined in: GeneticProgram.pm
Mainly used in: point_mutate()
See also: PointMutationDepthBias, MacroMutationDepthBias

Depth bias for crossover point sampling. See _random_node() for details. If the depth wasn't biased, then too often crossovers would take place between ``uninteresting'' leaf nodes and small subtrees.


XoverSizeBias

Data type: NUMBER (must not be zero)
Default: 1
Defined in: GeneticProgram.pm
Mainly used in: crossover()
See also: XoverHomologyBias

This controls the strictness of size-equal crossover point selection. By size-equal, I mean that crossover points are selected with a bias towards similar sized subtrees. Increase this (say to 2 or 4) and the algorithm described in crossover() spends longer looking for similar sized subtrees.


XoverHomologyBias

Data type: NUMBER (must not be zero)
Default: 1
Defined in: GeneticProgram.pm
Mainly used in: crossover()
See also: XoverSizeBias

This controls the strictness of homologous subtree crossover point selection. Increase this value to 2 or 4, for example, to tell the algorithm described in crossover() to spend longer looking for crossover points with similar subtree contents.


AsexualOnly

Data type: BOOLEAN
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: crossover()
See also:

If true, force all crossovers to use the root node, and hence make identical copies of both parents. All other crossover parameters are ignored.


XoverLogFile

Data type: STRING
Default: `results/crossover.log'
Defined in: GeneticProgram.pm
Mainly used in: crossover()
See also: XoverLogProb

The file (relative to the experiment directory) where some information about crossover point selection is logged.


XoverLogProb

Data type: NUMBER
Default: 1/50
Defined in: GeneticProgram.pm
Mainly used in: crossover()
See also: XoverLogFile

The fraction of recombination events for which XoverLogFile is written to.


MaxTreeNodes

Data type: NUMBER
Default: 1000
Defined in: GeneticProgram.pm
Mainly used in: _expand_tree()
See also: MinTreeNodes, TreeDepthMax, TreeDepthMin, TerminateTreeProb

Controls the maximum allowable tree size. The way this works is counter-intuitive so pay attention... Trees are allowed to be bigger than this size limit, however when the genome tree is converted into code, only the first MaxTreeNodes are expanded properly into what the ``code for'', all subsequent nodes are expanded into a randomly picked terminal (see _expand_tree()). This probably gives an disfunctional program and so indirectly prevents tree growth beyond this size. Note that this is really just a safety limit, not a recommended way to control code growth. Don't forget about MaxTreeNodes though, one day you will probably need to raise it.


MinTreeNodes

Data type: NUMBER
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: _init_tree()
See also: MaxTreeNodes, TreeDepthMax, TreeDepthMin, TerminateTreeProb

This attribute defines a minimum tree size (in nodes) for new trees only. If a brand new random tree (usually made during Population initialisation) has fewer than this number of nodes, then the tree is discarded and made again (and repeated until a big enough tree is generated). Currently this is implemented without a check for infinite looping, so watch out.

This attribute does not affect subtree generation.


TreeDepthMax

Data type: NUMBER
Default: 20
Defined in: GeneticProgram.pm
Mainly used in: _init_tree(), _grow_tree()
See also: TreeDepthMin, TerminateTreeProb, MaxTreeNodes, MinTreeNodes, NewSubtreeDepthMax

A fixed limit on tree depth for brand new trees only. When a growing branch of a tree reaches this limit, only terminals are added (like in Koza's and other GP implementations). Note that this is different to the implementation of MaxTreeNodes.

The default is just a safety limit because it is assumed that you are using a ``naturally terminating grammar''.


TerminateTreeProb

Data type: NUMBER
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: _grow_tree()
See also: TreeDepthMin

You may force the choice of terminals during new tree and subtree generation by setting this probability. It only has an effect at tree depths below TreeDepthMin. Note the default is zero.


TreeDepthMin

Data type: NUMBER
Default: 1
Defined in: GeneticProgram.pm
Mainly used in: _grow_tree()
See also: TerminateTreeProb

The minimum depth before tree growth is probabilistically terminated with TerminateTreeProb.


NewSubtreeDepthMean

Data type: NUMBER
Default: 20
Defined in: GeneticProgram.pm
Mainly used in: macro mutation operators
See also: NewSubtreeDepthMax

Many of the macro mutation operators need to make new subtrees. They call _grow_tree() with a specific tree depth maximum which is generated from a capped Poisson distribution with the mean parameter NewSubtreeDepthMean, and cap NewSubtreeDepthMax. The default setting is quite high and assumes that you have a ``naturally terminating grammar''.


NewSubtreeDepthMax

Data type: NUMBER
Default: 20
Defined in: GeneticProgram.pm
Mainly used in: macro mutation operators
See also: NewSubtreeDepthMean

A hard upper limit on the size of new subtrees (see NewSubtreeDepthMean).


UseExistingTerminalsFrac

Data type: NUMBER
Default: 0
Defined in: GeneticProgram.pm
Mainly used in: _random_existing_terminal()
See also: NumericMutationFrac, UseEncapsTerminalsFrac

The fraction or probability with which existing terminals (already in the genome tree) are used instead of the usual pool of terminals held in Terminals. Usually you will want to combine this with numeric mutation. See also point_mutate().


GetSizeIgnoreNTypes

Data type: HASH-REF
Default: empty
Defined in: GeneticProgram.pm
Mainly used in: getSize()
See also:

If you are using parsimony pressure in your fitness function, you might want getSize() to ignore the trees below certain nodetypes. In this case you can specify these nodetypes in this hash.


DBFileStem

Data type: STRING
Default: none, required attribute
Defined in: GeneticProgram.pm
Mainly used in: tieGenome()
See also: Population::findNewDBFileStem()

This is the file stem for the DBM file where the genome tree is stored. It is a required attribute. See the program perlgp-rand-prog.pl to see how you can make a random program using a temporary DBFileStem.


ExperimentId

Data type: STRING
Default: none, required attribute
Defined in: GeneticProgram.pm
Mainly used in: perlgp-run.pl
See also:

This is the name of the current experiment directory (not the full path).


Population

Data type: OBJECT
Default: none, required attribute
Defined in: GeneticProgram.pm
Mainly used in: not really used!
See also: perlgp-rand-prog.pl

Each Individual knows to which Population it belongs. Currently this is not actually used anywhere. Since it is compulsory, you have to proivide a dummy value in applications such as perlgp-rand-prog.pl, sorry about that - I guess this will change.


Functions

Data type: HASH-REF
Default: \%Grammar::F
Defined in: GeneticProgram.pm
Mainly used in: _random_function()
See also: Terminals

This is where the non-terminal grammar definitions are stored. In the hash, keys are nodetypes and the values are anonymous arrays containing different function options. More details of the format used can be found in Section 7. Usually this hash is shared between all Individual objects (otherwise memory usage would be heavy), hence the default is a reference to the hash %Grammar::F.

You could customise the Individual class to dynamically alter Functions and Terminals if you wanted to.


Terminals

Data type: HASH-REF
Default: \%Grammar::T
Defined in: GeneticProgram.pm
Mainly used in: _random_terminal()
See also: Functions

The terminal node options are stored here, see the entry for Functions, and also Section 7.


next up previous contents
Next: Class: Population Up: Class: Individual Previous: Methods   Contents
Bob MacCallum 2003-02-03