public class NEATNetwork extends java.lang.Object implements Prototype
Modifier and Type | Field and Description |
---|---|
NEATIndividual |
individual
The neat individual we belong to
|
java.util.ArrayList<NEATNode> |
inputs
A list of input nodes for this network.
|
java.util.ArrayList<NEATNode> |
nodes
A list of all nodes for this network.
|
java.util.ArrayList<NEATNode> |
outputs
A list of output nodes for this network.
|
static java.lang.String |
P_NETWORK |
static double |
SIGMOID_SLOPE
constant used for the sigmoid function
|
Constructor and Description |
---|
NEATNetwork() |
Modifier and Type | Method and Description |
---|---|
void |
activate(EvolutionState state)
Activates the net such that all outputs are active.
|
void |
addInput(NEATNode node)
Add a new input node.
|
void |
addOutput(NEATNode node)
Add a new output node.
|
void |
buildNetwork(NEATIndividual individual)
Create the phenotype (network) from the genotype (genome).
|
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 obj) |
void |
flush() |
double[] |
getOutputResults()
Produces an array of activation results, one per output node.
|
static void |
hasPath(EvolutionState state,
NEATNode toNode,
NEATNode fromNode,
java.util.HashSet<NEATNode> set,
int level,
int threshold,
boolean[] results)
The helper function to check if there is a path from fromNode to toNode.
|
static boolean[] |
hasPath(EvolutionState state,
NEATNode toNode,
NEATNode fromNode,
int threshold)
This checks a POTENTIAL link between start from fromNode to toNode to use
count and threshold to jump out in the case of an infinite loop.
|
void |
loadSensors(double[] vals)
Takes an array of sensor values and loads it into SENSOR inputs ONLY.
|
int |
maxDepth()
Find the maximum number of neurons between an output and an input.
|
boolean |
outputOff()
Check if not all output are active.
|
void |
setup(EvolutionState state,
Parameter base)
Sets up the object by reading it from the parameters stored
in state, built off of the parameter base base.
|
public static final java.lang.String P_NETWORK
public static final double SIGMOID_SLOPE
public NEATIndividual individual
public java.util.ArrayList<NEATNode> nodes
public java.util.ArrayList<NEATNode> inputs
public java.util.ArrayList<NEATNode> outputs
public void setup(EvolutionState state, Parameter base)
Prototype
For prototypes, setup(...) is typically called once for the prototype instance; cloned instances do not receive the setup(...) call. setup(...) may be called more than once; the only guarantee is that it will get called at least once on an instance or some "parent" object from which it was ultimately cloned.
public Parameter defaultBase()
Prototype
defaultBase
in interface Prototype
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 boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public void flush()
public void activate(EvolutionState state)
public void addInput(NEATNode node)
public void addOutput(NEATNode node)
public void loadSensors(double[] vals)
public double[] getOutputResults()
public static boolean[] hasPath(EvolutionState state, NEATNode toNode, NEATNode fromNode, int threshold)
public static void hasPath(EvolutionState state, NEATNode toNode, NEATNode fromNode, java.util.HashSet<NEATNode> set, int level, int threshold, boolean[] results)
public boolean outputOff()
public int maxDepth()
public void buildNetwork(NEATIndividual individual)