org.simnet.interfaces
Class Neuron

java.lang.Object
  extended by org.simnet.interfaces.Neuron
All Implemented Interfaces:
GaugeSource
Direct Known Subclasses:
AdditiveNeuron, BinaryNeuron, ClampedNeuron, DecayNeuron, ExponentialDecayNeuron, IACNeuron, IntegrateAndFireNeuron, IzhikevichNeuron, LinearNeuron, LMSNeuron, LogisticNeuron, NakaRushtonNeuron, RandomNeuron, RunningAverageNeuron, SigmoidalNeuron, SinusoidalNeuron, StochasticNeuron, TemporalDifferenceNeuron, ThreeValuedNeuron

public abstract class Neuron
extends Object
implements GaugeSource

Neuron represents a node in the neural network. Most of the "logic" of the neural network occurs here, in the update function


Field Summary
protected  double activation
          Activation value of the neuron.
protected  ArrayList fanIn
          List of synpases this neuron attaches to.
protected  ArrayList fanOut
          List of synapses attaching to this neuron.
protected  double lowerBound
          Minimum value this neuron can take.
protected  double upperBound
          Maximum value this neuron can take.
 
Constructor Summary
Neuron()
          Default constructor needed for external calls which create neurons then set their parameters.
Neuron(double x, double y)
          Initialize a neuron with spatial coordinates.
Neuron(Neuron n)
          This constructor is used when creating a neuron of one type from another neuron of another type only values.
 
Method Summary
 void addActivation(double amount)
          Add specified amount of activation to this neuron.
 void addSource(Synapse source)
          Connect this neuron to source neuron via a weight.
 void addTarget(Synapse target)
          Connect this neuron to target neuron via a weight.
 void checkBounds()
          If activation is above or below its bounds set it to those bounds.
 void clear()
          Set activation to 0; override for other "clearing" behavior.
 double clip(double value)
          If value is above or below its bounds set it to those bounds.
 boolean connectedToWeight(Synapse w)
          Check if this neuron is connected to a given weight.
 boolean containsString(ArrayList src, String target)
          Utility method to see if an array of names (from the world) contains a target string.
 void debug()
          Sends relevant information about the network to standard output.
 void decrementActivation()
          Decrement this neuron by increment.
 void deleteConnectedSynapses()
          Delete connected synapses.
 void deleteFanIn()
          Delete fan in.
 void deleteFanOut()
          Delete fan out.
abstract  Neuron duplicate()
           
 Neuron duplicate(Neuron n)
          Creates a duplicate of this neuron; used in copy/paste.
 double getActivation()
           
 double getAverageInput()
           
 double getBuffer()
           
 ArrayList getFanIn()
           
 ArrayList getFanOut()
           
 double getGaugeValue()
           
 String getHelp()
          Returns help information related to this neuron type.
 String getId()
           
 double getIncrement()
           
 double getInputValue()
           
 double getLowerBound()
           
 MotorCoupling getMotorCoupling()
           
static int getNeuronTypeIndex(String type)
          Helper function for combo boxes.
 int getNumberOfActiveInputs(int threshold)
          Returns the number of neurons attaching to this one which have activity above a specified threshold.
 Network getParentNetwork()
           
 SensoryCoupling getSensoryCoupling()
           
 double getSummedIncomingWeights()
          Returns the sum of the strengths of the weights attaching to this neuron.
abstract  int getTimeType()
           
 String getToolTipText()
          Returns string for tool tip or short description.
 double getTotalInput()
           
 String getType()
           
static String[] getTypeList()
           
 double getUpperBound()
           
 double getWeightedInputs()
          Sums the weighted signals that are sent to this node.
 double getX()
           
 double getY()
           
 void incrementActivation()
          Increment this neuron by increment.
 void initCastor()
          Initializes the castor for sensory and motor couplings.
 boolean isInput()
          Return true if this neuron has a sensory coupling attached.
 boolean isOutput()
          Return true if this neuron has a motor coupling attached.
 void randomize()
          Randomize this neuron to a value between upperBound and lowerBound.
 void randomizeBuffer()
          Randomize this neuron to a value between upperBound and lowerBound.
 void round(int precision)
          Round the activation level of this neuron off to a specified precision.
 void setActivation(double act)
          Sets the activation of the neuron.
 void setBuffer(double d)
          Temporary buffer which can be used for algorithms which should not depend on the order in which neurons are updated.
 void setFanIn(ArrayList fanIn)
           
 void setFanOut(ArrayList fanOut)
           
 void setId(String theName)
          Sets the id of the neuron.
 void setIncrement(double d)
          Sets the neuron increment.
 void setInputValue(double inputValue)
           
 void setLowerBound(double d)
          Sets the lower bound of the neuron.
 void setMotorCoupling(MotorCoupling motorCoupling)
           
 void setParentNetwork(Network network)
           
 void setSensoryCoupling(SensoryCoupling sc)
           
static void setTypeList(String[] typeList)
           
 void setUpperBound(double d)
          Sets the upper bound of the neuron.
 void setX(double x)
           
 void setY(double y)
           
 String toString()
           
abstract  void update()
          Updates network with attached world.
 void updateConnectedOutward()
          Update all neurons n this neuron is connected to, by adding current activation times the connection-weight NOT CURRENTLY USED.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

activation

protected double activation
Activation value of the neuron. The main state variable.


lowerBound

protected double lowerBound
Minimum value this neuron can take.


upperBound

protected double upperBound
Maximum value this neuron can take.


fanOut

protected ArrayList fanOut
List of synapses attaching to this neuron.


fanIn

protected ArrayList fanIn
List of synpases this neuron attaches to.

Constructor Detail

Neuron

public Neuron()
Default constructor needed for external calls which create neurons then set their parameters.


Neuron

public Neuron(double x,
              double y)
Initialize a neuron with spatial coordinates.

Parameters:
x - x coordinate of new neuron.
y - y coordinate of new neuron.

Neuron

public Neuron(Neuron n)
This constructor is used when creating a neuron of one type from another neuron of another type only values. common to different types of neuron are copied

Parameters:
n - Neuron
Method Detail

duplicate

public Neuron duplicate(Neuron n)
Creates a duplicate of this neuron; used in copy/paste.

Parameters:
n - Neuron to duplicate
Returns:
duplicate neuron

getTimeType

public abstract int getTimeType()
Returns:
the time type.

duplicate

public abstract Neuron duplicate()
Returns:
a duplicate neuron.

update

public abstract void update()
Updates network with attached world.


initCastor

public void initCastor()
Initializes the castor for sensory and motor couplings.


containsString

public boolean containsString(ArrayList src,
                              String target)
Utility method to see if an array of names (from the world) contains a target string.

Parameters:
src - the list of Strings
target - the string to check for
Returns:
whether src is contained in target or not

setActivation

public void setActivation(double act)
Sets the activation of the neuron.

Parameters:
act - Activation

getActivation

public double getActivation()
Returns:
the level of activation.

getGaugeValue

public double getGaugeValue()
Specified by:
getGaugeValue in interface GaugeSource
Returns:
Current gauge value.
See Also:
GaugeSource

getId

public String getId()
Specified by:
getId in interface GaugeSource
Returns:
ID of neuron.

setId

public void setId(String theName)
Sets the id of the neuron.

Parameters:
theName - Neuron id

getUpperBound

public double getUpperBound()
Returns:
upper bound of the neuron.

setUpperBound

public void setUpperBound(double d)
Sets the upper bound of the neuron.

Parameters:
d - Value to set upper bound

getLowerBound

public double getLowerBound()
Returns:
lower bound of the neuron.

setLowerBound

public void setLowerBound(double d)
Sets the lower bound of the neuron.

Parameters:
d - Value to set lower bound

getIncrement

public double getIncrement()
Returns:
the neuron increment.

setIncrement

public void setIncrement(double d)
Sets the neuron increment.

Parameters:
d - Value to set increment

getFanIn

public ArrayList getFanIn()
Returns:
the fan in array list.

getFanOut

public ArrayList getFanOut()
Returns:
the fan out array list.

setFanIn

public void setFanIn(ArrayList fanIn)
Parameters:
fanIn - The fanIn to set.

setFanOut

public void setFanOut(ArrayList fanOut)
Parameters:
fanOut - The fanOut to set.

incrementActivation

public void incrementActivation()
Increment this neuron by increment.


decrementActivation

public void decrementActivation()
Decrement this neuron by increment.


addTarget

public void addTarget(Synapse target)
Connect this neuron to target neuron via a weight.

Parameters:
target - the connnection between this neuron and a target neuron

addSource

public void addSource(Synapse source)
Connect this neuron to source neuron via a weight.

Parameters:
source - the connnection between this neuron and a source neuron

addActivation

public void addActivation(double amount)
Add specified amount of activation to this neuron.

Parameters:
amount - amount to add to this neuron

getWeightedInputs

public double getWeightedInputs()
Sums the weighted signals that are sent to this node.

Returns:
weighted input to this node

randomize

public void randomize()
Randomize this neuron to a value between upperBound and lowerBound.


randomizeBuffer

public void randomizeBuffer()
Randomize this neuron to a value between upperBound and lowerBound.


updateConnectedOutward

public void updateConnectedOutward()
Update all neurons n this neuron is connected to, by adding current activation times the connection-weight NOT CURRENTLY USED.


connectedToWeight

public boolean connectedToWeight(Synapse w)
Check if this neuron is connected to a given weight.

Parameters:
w - weight to check
Returns:
true if this neuron has w in its fan_in or fan_out

round

public void round(int precision)
Round the activation level of this neuron off to a specified precision.

Parameters:
precision - precision to round this neuron's activaion off to

checkBounds

public void checkBounds()
If activation is above or below its bounds set it to those bounds.


clip

public double clip(double value)
If value is above or below its bounds set it to those bounds.

Parameters:
value - Value to check
Returns:
clip

debug

public void debug()
Sends relevant information about the network to standard output. TODO: Change to toString()


getParentNetwork

public Network getParentNetwork()
Returns:
reference to the Network object this neuron is part of

setParentNetwork

public void setParentNetwork(Network network)
Parameters:
network - reference to the Network object this neuron is part of.

setBuffer

public void setBuffer(double d)
Temporary buffer which can be used for algorithms which should not depend on the order in which neurons are updated.

Parameters:
d - temporary value

getBuffer

public double getBuffer()
Returns:
Returns the current value in the buffer.

getInputValue

public double getInputValue()
Returns:
Returns the inputValue.

setInputValue

public void setInputValue(double inputValue)
Parameters:
inputValue - The inputValue to set.

getType

public String getType()
Returns:
the name of the class of this network.

getHelp

public String getHelp()
Returns help information related to this neuron type. Maybe be formatted using simple html

Returns:
information related to this neuron type

getTypeList

public static String[] getTypeList()
Returns:
Returns the typeList.

setTypeList

public static void setTypeList(String[] typeList)
Parameters:
typeList - The typeList to set.

getNeuronTypeIndex

public static int getNeuronTypeIndex(String type)
Helper function for combo boxes. Associates strings with indices.

Parameters:
type - Type of neuron to get index
Returns:
neuron type index

getSummedIncomingWeights

public double getSummedIncomingWeights()
Returns the sum of the strengths of the weights attaching to this neuron.

Returns:
the sum of the incoming weights to this nueron.

getNumberOfActiveInputs

public int getNumberOfActiveInputs(int threshold)
Returns the number of neurons attaching to this one which have activity above a specified threshold.

Parameters:
threshold - value above which neurons are considered "active."
Returns:
number of "active" neurons

getAverageInput

public double getAverageInput()
Returns:
the average activation of neurons connecting to this neuron

getTotalInput

public double getTotalInput()
Returns:
the total activation of neurons connecting to this neuron

getMotorCoupling

public MotorCoupling getMotorCoupling()
Returns:
Returns the motorCoupling.

setMotorCoupling

public void setMotorCoupling(MotorCoupling motorCoupling)
Parameters:
motorCoupling - The motorCoupling to set.

getSensoryCoupling

public SensoryCoupling getSensoryCoupling()
Returns:
Returns the sensoryCoupling.

setSensoryCoupling

public void setSensoryCoupling(SensoryCoupling sc)
Parameters:
sc - the new SensoryCoupling object.

isOutput

public boolean isOutput()
Return true if this neuron has a motor coupling attached.

Returns:
true if this neuron has a motor coupling attached

isInput

public boolean isInput()
Return true if this neuron has a sensory coupling attached.

Returns:
true if this neuron has a sensory coupling attached

getX

public double getX()
Returns:
Returns the x coordinate.

setX

public void setX(double x)
Parameters:
x - The x coordinate to set.

getY

public double getY()
Returns:
Returns the y coordinate.

setY

public void setY(double y)
Parameters:
y - The y coordinate to set.

deleteConnectedSynapses

public void deleteConnectedSynapses()
Delete connected synapses.


deleteFanIn

public void deleteFanIn()
Delete fan in.


deleteFanOut

public void deleteFanOut()
Delete fan out.


toString

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

clear

public void clear()
Set activation to 0; override for other "clearing" behavior.


getToolTipText

public String getToolTipText()
Returns string for tool tip or short description.

Returns:
tool tip text