com.anji.nn
Class NeuronConnection

java.lang.Object
  extended by com.anji.nn.NeuronConnection
All Implemented Interfaces:
Connection
Direct Known Subclasses:
CacheNeuronConnection

public class NeuronConnection
extends java.lang.Object
implements Connection

Connection between neurons.

Author:
Philip Tucker

Field Summary
 
Fields inherited from interface com.anji.nn.Connection
XML_TAG
 
Constructor Summary
NeuronConnection(Neuron anIncoming)
           
NeuronConnection(Neuron anIncoming, double aWeight)
          Create connection with input neuron anIncoming and weight aWeight.
 
Method Summary
static void appendToXml(java.util.Collection allNeurons, java.lang.StringBuffer result)
          Utility method to convert collection of connections, presumably an entire ANN, to XML.
 long cost()
           
protected  long getId()
          for tracking back to chromosome innovation id
protected  Neuron getIncomingNode()
           
protected  double getWeight()
           
 boolean isRecurrent()
           
 double read()
           
 void setId(long l)
           
 void setWeight(double f)
           
 java.lang.String toString()
           
 java.lang.String toXml()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NeuronConnection

public NeuronConnection(Neuron anIncoming)
Parameters:
anIncoming -
See Also:
NeuronConnection(Neuron, double)

NeuronConnection

public NeuronConnection(Neuron anIncoming,
                        double aWeight)
Create connection with input neuron anIncoming and weight aWeight.

Parameters:
anIncoming -
aWeight -
Method Detail

setWeight

public void setWeight(double f)
Parameters:
f - new weight

read

public double read()
Specified by:
read in interface Connection
Returns:
double

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

toXml

public java.lang.String toXml()
Specified by:
toXml in interface Connection
Returns:
String XML representation of object

setId

public void setId(long l)
Parameters:
l - new innovation ID

getId

protected long getId()
for tracking back to chromosome innovation id

Returns:
long ID

getIncomingNode

protected Neuron getIncomingNode()
Returns:
Neuron input

getWeight

protected double getWeight()
Returns:
double connection weight

appendToXml

public static void appendToXml(java.util.Collection allNeurons,
                               java.lang.StringBuffer result)
Utility method to convert collection of connections, presumably an entire ANN, to XML. XML representation is consistent with NEVT .

Parameters:
allNeurons -
result -

isRecurrent

public boolean isRecurrent()
Returns:
false

cost

public long cost()
Specified by:
cost in interface Connection
Returns:
number corresponding to cost of activation in resources
See Also:
Connection.cost()