|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectUtil.GenotypeHelper
public class GenotypeHelper
A collection of useful functions for manipulating genotype and such
Method Summary | |
---|---|
static DerivationTree |
buildDerivationTree(Individual individual)
Build a derivation tree for a given individual |
static DerivationTree |
buildDerivationTree(Individual individual,
DerivationNode node)
Build a derivation tree rooted at the specified node for a given individual. |
static DerivationTree |
buildInvalidTree(Individual individual)
Build a derivation tree for a given individual |
static DerivationTree |
buildInvalidTree(Individual individual,
DerivationNode node)
Build derivation trees for invalid individuals for repair operators. |
static int |
calcNodeLength(DerivationNode nodes)
Calculate how may codons are used to build a specified branch of a tree. |
static boolean |
derivationTreesEqual(DerivationTree t1,
DerivationTree t2)
Compare the derivation trees for equality. |
static Individual |
extendChromeAtRecursiveNode(Individual indiv,
GEChromosome giver,
Symbol giverSym,
int mutatePoint)
|
static int |
extendRecursiveNode(int codonToChange,
Individual indiv,
Symbol childRootSym)
This method takes the codon that's going to change and determines how it needs to change in order to map to the correct production. |
static int |
findLastRecIndex(DerivationNode dNode,
GEGrammar gram)
This method takes a derivation node and a grammar and returns the codon index of the last recurisve node in the derivation tree. |
static int |
findLastRecIndex(Individual indiv)
This method takes and individual and returns the codon index of the last recurisve node in the derivation tree. |
static DerivationNode |
findNodeFromCodonIndex(DerivationTree tree,
int codonIndex)
Given a derivation tree and a codon index, return the tree node that makes use of the codon at that index. e.g., if codonIndex was 0, the root branch decides which production is picked based on the value of the codon at index 0, so the root is returned in this case |
static DerivationNode |
findNodeFromCodonIndex(DerivationTree tree,
int codonIndex,
int usedGenes)
|
static java.util.ArrayList<java.lang.Integer> |
getDerivationTreeIndeces(DerivationTree dT)
|
static int |
getMaxDTIndex(DerivationTree dT)
Method to return the maximum codon index value in a derivation tree |
static Phenotype |
getNodePhenotype(DerivationNode node)
|
static int[] |
getRecursiveNodeIndeces(DerivationTree dt,
GEGrammar gram)
Return an array with all the indeces of recursive derivation tree nodes. |
static GEChromosome |
makeNewChromosome(Individual i1,
int point,
int length,
Individual i2,
DerivationTree tree)
Given two individuals, whose chromosomes are split into three codon groups running from [0..point1), [point1..point1+length), and [point1+length..usedGenes), named head, body, and tail respectively, return a chromosome with a head and tail made up of individual-one's chromosome, and all of individual-two, i.e., head(i1)+all(i2)+tail(i1). |
static GEChromosome |
makeNewChromosome(Individual i1,
int point1,
int length1,
Individual i2,
int point2,
int length2)
Given two individuals, whoses chromosomes are split into three codon groups running from [0..point1), [point1..point1+length), and [point1+length..usedGenes), named head, body, and tail respectively, return a chromosome with a head and tail made up of individual-one's chromosome, and individual-two's body, i.e., head(i1)+body(i2)+tail(i1). |
static GEChromosome |
makeNewChromosome(Individual i1,
int point1,
int length1,
Individual i2,
int point2,
int length2,
DerivationTree tree)
|
static int |
nodesDifferentAtIndex(DerivationNode n1,
DerivationNode n2)
This method is used to compare two different derivation nodes to see at which index in the tree, they differ. |
static int |
numRecNodes(DerivationTree tree,
GEGrammar gram)
This method takes a derivation tree and a grammar and returns the number of recursive nodes in that derivation tree. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static DerivationTree buildDerivationTree(Individual individual, DerivationNode node)
public static DerivationTree buildInvalidTree(Individual individual, DerivationNode node)
individual
- Individual
public static DerivationTree buildInvalidTree(Individual individual)
public static DerivationTree buildDerivationTree(Individual individual)
public static DerivationNode findNodeFromCodonIndex(DerivationTree tree, int codonIndex)
public static DerivationNode findNodeFromCodonIndex(DerivationTree tree, int codonIndex, int usedGenes)
public static int calcNodeLength(DerivationNode nodes)
public static GEChromosome makeNewChromosome(Individual i1, int point1, int length1, Individual i2, int point2, int length2)
i1
- The individual whose genotype will be the head and tail of the
new chromosomepoint1
- The index of the body (excluded from new chromosome)length1
- The length of the body (excluded from new chromosome)i2
- The individual whose genotype will be the body of the new
chromosomepoint2
- The index of the body (included from new chromosome)length2
- The length of the body (included from new chromosome)
public static GEChromosome makeNewChromosome(Individual i1, int point1, int length1, Individual i2, int point2, int length2, DerivationTree tree)
public static GEChromosome makeNewChromosome(Individual i1, int point, int length, Individual i2, DerivationTree tree)
i1
- The individual whose genotype will be the head and tail of the
new chromosomepoint
- The index of the body (excluded from new chromosome)length
- The length of the body (excluded from new chromosome)i2
- The individual whose genotype will be the body of the new
chromosome
public static int getMaxDTIndex(DerivationTree dT)
public static boolean derivationTreesEqual(DerivationTree t1, DerivationTree t2)
public static int[] getRecursiveNodeIndeces(DerivationTree dt, GEGrammar gram)
public static Individual extendChromeAtRecursiveNode(Individual indiv, GEChromosome giver, Symbol giverSym, int mutatePoint)
indiv
- Individual to extendgiver
- GEChromosome used to extend the indivgiverSym
- Symbol of the node in the derivation tree that
marks the beginning of the chromosome being givenmutatePoint
- Point on indiv's chromosome that is getting
the new information
public static int findLastRecIndex(Individual indiv)
indiv
- The individual to search
public static int findLastRecIndex(DerivationNode dNode, GEGrammar gram)
dNode
- The derivation node to searchgram
- The grammar to use for information about the rules
public static int extendRecursiveNode(int codonToChange, Individual indiv, Symbol childRootSym)
codonToChange
- The original codon valueindiv
- The parent individual that will be the basis for
remappingchildRootSym
- The root symbol of the child that needs to
be picked up
public static int numRecNodes(DerivationTree tree, GEGrammar gram)
tree
- Derivation tree to searchgram
- Grammar corresponding to the derivation tree
public static int nodesDifferentAtIndex(DerivationNode n1, DerivationNode n2)
public static java.util.ArrayList<java.lang.Integer> getDerivationTreeIndeces(DerivationTree dT)
public static Phenotype getNodePhenotype(DerivationNode node)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |