All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gpsys.GeneBranch

java.lang.Object
   |
   +----gpsys.GeneBranch

public class GeneBranch
extends Object
A GeneBranch defines a Gene subtree of a GP Gene tree. It has instance variables defining the parent Gene of this subtree, and where it is referenced in the parent. The GeneBranch provides suffiecient information to allow a subtree to be replaced by another one. The latter could be generated either by creation (for mutation) or crossover.

Author:
Adil Qureshi
Department of Computer Science,
University College London,
Gower St,
London WC1E 6BT,
UK.

Variable Index

 o child
The Gene subtree itself.
 o index
The arguments index of this Gene subtree in the parent Gene.
 o parent
The parent of the Gene subtree.
 o TYPE_VECTOR_SIZE
The default size of the vector used for keeping subtrees of a given type.

Constructor Index

 o GeneBranch(Random, Gene)
select a subtree at random from the given tree.
 o GeneBranch(Random, Gene, Type)
select a subtree of a given type at random from the given tree.

Method Index

 o branchesOfType(Gene, int, Gene, Type, Vector)
Get a table of all subtrees of a given type
 o selectBranch(Random, Gene)
select a subtree of at random from the given tree.
 o selectBranch(Random, Gene, Type)
select a subtree of at random from the given tree.

Variables

 o parent
 public Gene parent
The parent of the Gene subtree.

 o index
 public int index
The arguments index of this Gene subtree in the parent Gene.

 o child
 public Gene child
The Gene subtree itself.

 o TYPE_VECTOR_SIZE
 public static final int TYPE_VECTOR_SIZE
The default size of the vector used for keeping subtrees of a given type.

Constructors

 o GeneBranch
 public GeneBranch(Random rng,
                   Gene treeTop)
select a subtree at random from the given tree.

Parameters:
rng - the random number generator to be used.
treeTop - the tree from which to select a subtree.
 o GeneBranch
 public GeneBranch(Random rng,
                   Gene treeTop,
                   Type type)
select a subtree of a given type at random from the given tree.

Parameters:
rng - the random number generator to be used.
treeTop - the tree from which to select a subtree.
type - the type of the subtree to be selected.

Methods

 o selectBranch
 public void selectBranch(Random rng,
                          Gene tree)
select a subtree of at random from the given tree. Initialise the instance variable to reflect the selected tree.

Parameters:
rng - the random number generator to be used.
tree - the tree from which to select a subtree.
 o selectBranch
 public void selectBranch(Random rng,
                          Gene tree,
                          Type type)
select a subtree of at random from the given tree. Initialise the instance variable to reflect the selected tree.

Parameters:
rng - the random number generator to be used.
tree - the tree from which to select a subtree.
 o branchesOfType
 public static void branchesOfType(Gene parent,
                                   int index,
                                   Gene child,
                                   Type type,
                                   Vector branches)
Get a table of all subtrees of a given type

Parameters:
parent - the parent Gene of the child.
index - the arguments index of the child in the parent.
child - the child Gene subtree.
type - the type of subtree required.
branches - the table of subtrees.

All Packages  Class Hierarchy  This Package  Previous  Next  Index