public class NEATGene extends Gene
Modifier and Type | Field and Description |
---|---|
boolean |
enable
Is the link this gene represent is enable in network activation.
|
boolean |
frozen
Is this gene frozen, a frozen gene's weight cannot get mutated in
breeding procedure.
|
NEATNode |
inNode
The actual in node this gene connect to.
|
int |
inNodeId
The id of the in node, this is useful in reading a gene from file, we
will use this id to find the actual node after we finish reading the
genome file.
|
int |
innovationNumber
The innovation number of this link.
|
boolean |
isRecurrent
Is the link this gene represent a recurrent link.
|
double |
mutationNumber
The mutation number of this gene, Used to see how much mutation has
changed.
|
NEATNode |
outNode
The actual out node this gene connect to.
|
int |
outNodeId
The id of the in node, this is useful in reading a gene from file, we
will use this id to find the actual node after we finish reading the
genome file.
|
static java.lang.String |
P_GENE |
boolean |
timeDelay
Time delay of the link, used in network activation.
|
double |
weight
The weight of link this gene is represent.
|
Constructor and Description |
---|
NEATGene() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a new individual cloned from a prototype,
and suitable to begin use in its own evolutionary
context.
|
Parameter |
defaultBase()
Returns the default base for this prototype.
|
boolean |
equals(java.lang.Object o)
Unlike the standard form for Java, this function should return true if this
gene is "genetically identical" to the other gene.
|
int |
hashCode()
"Placeholder" method for generating a hashcode.
|
java.lang.String |
printGeneToString()
This method is used to output a gene that is same as the format in start
genome file.
|
java.lang.String |
printGeneToStringForHumans()
Prints the gene to a string in a human-readable fashion.
|
void |
readGeneFromString(java.lang.String string,
EvolutionState state)
This method is used to read a gene in start genome from file.
|
void |
reset(double w,
int iNodeId,
int oNodeId,
boolean recur,
int innov,
double mutNum)
Reset the gene with given parameters.
|
void |
reset(EvolutionState state,
int thread)
The reset method randomly reinitializes the gene.
|
void |
setup(EvolutionState state,
Parameter base)
The setup method initializes a "meaningless" gene that does not specify
any connection.
|
java.lang.String |
toString()
This method convert the gene in to human readable format.
|
public static final java.lang.String P_GENE
public double weight
public NEATNode inNode
public NEATNode outNode
public int inNodeId
public int outNodeId
public boolean isRecurrent
public boolean timeDelay
public int innovationNumber
public double mutationNumber
public boolean enable
public boolean frozen
public void setup(EvolutionState state, Parameter base)
public Parameter defaultBase()
Prototype
defaultBase
in interface Prototype
defaultBase
in class Gene
public void reset(EvolutionState state, int thread)
Gene
public void reset(double w, int iNodeId, int oNodeId, boolean recur, int innov, double mutNum)
public java.lang.Object clone()
Prototype
Typically this should be a full "deep" clone. However, you may share certain elements with other objects rather than clone hem, depending on the situation:
Implementations.
public Object clone()
{
try
{
return super.clone();
}
catch ((CloneNotSupportedException e)
{ throw new InternalError(); } // never happens
}
public Object clone()
{
try
{
MyObject myobj = (MyObject) (super.clone());
// put your deep-cloning code here...
}
catch ((CloneNotSupportedException e)
{ throw new InternalError(); } // never happens
return myobj;
}
public Object clone()
{
MyObject myobj = (MyObject) (super.clone());
// put your deep-cloning code here...
return myobj;
}
public java.lang.String printGeneToStringForHumans()
Gene
printGeneToStringForHumans
in class Gene
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String printGeneToString()
printGeneToString
in class Gene
public void readGeneFromString(java.lang.String string, EvolutionState state)
readGeneFromString
in class Gene
public int hashCode()