|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.simnet.interfaces.Network
public abstract class Network
Network provides core neural network functionality and is the the main API for external calls. Network objects are sets of neurons and weights connecting them. Much of the actual update and learning logic occurs (currently) in the individual nodes.
| Field Summary | |
|---|---|
static int |
CONTINUOUS
If this is a continuous-time network. |
static int |
DISCRETE
If this is a discrete-time network. |
| Constructor Summary | |
|---|---|
Network()
Used to create an instance of network (Default constructor). |
|
| Method Summary | |
|---|---|
void |
addNetwork(Network n)
Adds a new network. |
void |
addNetworkList(ArrayList networks)
Add an array of networks and set their parents to this. |
void |
addNetworkListener(NetworkListener l)
Add the specified network listener. |
void |
addNeuron(Neuron neuron)
Adds a new neuron. |
protected void |
addNeuron(Neuron neuron,
boolean notify)
Adds a new neuron. |
void |
addNeuronList(ArrayList neurons)
Add an array of neurons and set their parents to this. |
void |
addWeight(Synapse weight)
Adds a weight to the neuron network, where that weight already has designated source and target neurons. |
protected void |
addWeight(Synapse weight,
boolean notify)
Adds a weight to the neuron network, where that weight already has designated source and target neurons. |
void |
changeNeuron(Neuron oldNeuron,
Neuron newNeuron)
Replace one neuron with another. |
void |
changeSynapse(Synapse oldSynapse,
Synapse newSynapse)
Change synapse type / replace one synapse with another. |
void |
checkAllBounds()
Calls Neuron.checkBounds() for each neuron, which makes sure the neuron has not exceeded its upper bound
or gone below its lower bound. |
void |
clearActivations()
Set the activation level of all neurons to zero. |
void |
clearInputs()
Clears out input values of network nodes, which otherwise linger and cause problems. |
void |
close()
Notify any objects observing this network that it has closed. |
void |
deleteNetwork(Network toDelete)
Delete network. |
void |
deleteNeuron(Neuron toDelete)
Deletes a neuron from the network. |
protected void |
deleteNeuron(Neuron toDelete,
boolean notify)
Deletes a neuron from the network. |
void |
deleteWeight(Synapse toDelete)
Delete a specified weight. |
protected void |
deleteWeight(Synapse toDelete,
boolean notify)
Delete a specified weight. |
void |
fireClampChanged()
Fire a clamp changed event to all registered model listeners. |
void |
fireCouplingChanged(Neuron n)
Fire a coupling changed event to all registered model listeners. |
void |
fireNetworkChanged()
Fire a network changed event to all registered model listeners. |
void |
fireNeuronAdded(Neuron added)
Fire a neuron added event to all registered model listeners. |
void |
fireNeuronChanged(Neuron old,
Neuron changed)
Fire a neuron changed event to all registered model listeners. |
void |
fireNeuronDeleted(Neuron deleted)
Fire a neuron deleted event to all registered model listeners. |
void |
fireSubnetAdded(Network added)
Fire a subnetwork added event to all registered model listeners. |
void |
fireSubnetDeleted(Network deleted)
Fire a subnetwork deleted event to all registered model listeners. |
void |
fireSynapseAdded(Synapse added)
Fire a neuron added event to all registered model listeners. |
void |
fireSynapseChanged(Synapse old,
Synapse changed)
Fire a neuron deleted event to all registered model listeners. |
void |
fireSynapseDeleted(Synapse deleted)
Fire a neuron deleted event to all registered model listeners. |
boolean |
getClampNeurons()
|
boolean |
getClampWeights()
|
ArrayList |
getCouplingList()
Returns a list of all couplings associated with neurons in this network. |
int |
getDepth()
|
ArrayList |
getFlatNetworkList()
Create "flat" list of all subnetworks. |
ArrayList |
getFlatNeuronList()
Create "flat" list of neurons, which includes the top-level neurons plus all subnet neurons. |
ArrayList |
getFlatSynapseList()
Create "flat" list of synapses, which includes the top-level synapses plus all subnet synapses. |
String |
getId()
Return the id of this neuron. |
String |
getIndents()
|
Collection |
getInputNeurons()
Returns all Input Neurons. |
InteractionMode |
getInteractionMode()
Return the current interaction mode for this network panel. |
HashSet |
getListenerList()
Return the top level listener list. |
Network |
getNetwork(int i)
|
ArrayList |
getNetworkList()
|
Network |
getNetworkParent()
|
NetworkThread |
getNetworkThread()
|
Neuron |
getNeuron(int index)
|
Neuron |
getNeuron(String id)
Find a neuron with a given string id. |
int |
getNeuronCount()
|
ArrayList |
getNeuronList()
|
Collection |
getOutputNeurons()
Returns all Output Neurons. |
int |
getPrecision()
|
Network |
getRoot()
Returns the top-level network in the hierarchy. |
boolean |
getRoundingOff()
|
double[] |
getState()
Returns the "state" of the network--the activation level of its neurons. |
Synapse |
getSynapse(String id)
Find a synapse with a given string id. |
double |
getTime()
Returns the current time. |
String |
getTimeLabel()
|
double |
getTimeStep()
|
int |
getTimeType()
|
String |
getType()
|
static String[] |
getUnits()
|
Synapse |
getWeight(int index)
|
Synapse |
getWeight(int i,
int j)
Gets the weight at particular point. |
static Synapse |
getWeight(Neuron src,
Neuron tar)
Returns a reference to the synapse connecting two neurons, or null if there is none. |
int |
getWeightCount()
|
ArrayList |
getWeightList()
|
Workspace |
getWorkspace()
|
void |
init()
Initialize the network. |
void |
initNeurons()
Inits neurons. |
void |
initParents()
Initializes parent networks. |
void |
initWeights()
Updates weights with fan-in. |
boolean |
isRoot()
True if this is the top level network, false if it is a subnetwork. |
boolean |
isRoundOffActivationValues()
|
boolean |
isUpdateCompleted()
Used by Network thread to ensure that an update cycle is complete before updating again. |
void |
randomizeNeurons()
Randomizes all neurons. |
void |
randomizeWeights()
Randomizes all weights. |
void |
removeNetworkListener(NetworkListener l)
Remove the specified network listener. |
static double |
round(double value,
int decimalPlace)
Round a value off to indicated number of decimal places. |
void |
roundAll()
Round activations of to intergers; for testing. |
void |
setClampNeurons(boolean clampNeurons)
Sets neurons to clamped values. |
void |
setClampWeights(boolean clampWeights)
Sets weights to clamped values. |
void |
setId(String id)
The id of this neuron; used in persistence. |
void |
setInteractionMode(InteractionMode interactionMode)
Set the current interaction mode for this network panel to interactionMode. |
void |
setLowerBounds(double l)
Sets the lower bounds. |
void |
setNetworkList(ArrayList networkList)
|
void |
setNetworkParent(Network parentNet)
|
void |
setNetworkThread(NetworkThread networkThread)
|
void |
setNeuronList(ArrayList neuronList)
|
void |
setPrecision(int i)
Sets the degree to which to round off values. |
void |
setRoundingOff(boolean b)
Whether to round off neuron values. |
void |
setRoundOffActivationValues(boolean roundOffActivationValues)
|
void |
setTime(double i)
Set the current time. |
void |
setTimeStep(double timeStep)
|
void |
setUpdateCompleted(boolean b)
Used by Network thread to ensure that an update cycle is complete before updating again. |
void |
setUpperBounds(double u)
Sets the upper bounds. |
void |
setWeightList(ArrayList weightList)
|
void |
setWeightsToZero()
Sets all weight values to zero, effectively eliminating them. |
void |
setWorkspace(Workspace workspace)
|
String |
toString()
|
abstract void |
update()
Update the network. |
void |
updateAllNetworks()
Updates all networks. |
void |
updateAllNeurons()
Calls Neuron.update() for each neuron. |
void |
updateAllWeights()
Calls Synapse.update() for each weight. |
void |
updateIds()
Update all ids. |
void |
updateInputs()
Update input nodes of the network based on the state of the world. |
void |
updateTime()
Increment the time counter, using a different method depending on whether this is a continuous or discrete. |
void |
updateTimeType()
If there is a single continuous neuron in the network, consider this a continuous network. |
void |
updateTopLevel()
Externally called update function which coordiantes input and output neurons and connections with worlds and gauges. |
void |
updateWorldListeners(World toCheck)
Check if any input or output neurons are coupled to a given world, and stop listening to that world if none are. |
void |
updateWorlds()
Go through each output node and send the associated output value to the world component. |
void |
worldChanged()
Respond to worldChanged event. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DISCRETE
public static final int CONTINUOUS
| Constructor Detail |
|---|
public Network()
| Method Detail |
|---|
public abstract void update()
public void updateTopLevel()
public void updateAllNetworks()
public void worldChanged()
worldChanged in interface WorldListenerpublic void clearInputs()
public void updateWorlds()
public void updateInputs()
public void init()
public void initWeights()
public void initNeurons()
public String getType()
public int getDepth()
public String getIndents()
public ArrayList getNeuronList()
public ArrayList getWeightList()
public int getNeuronCount()
public Neuron getNeuron(int index)
index - Number of neuron in array list.
public Neuron getNeuron(String id)
id - id to search for.
public Synapse getSynapse(String id)
id - id to search for.
protected void addNeuron(Neuron neuron,
boolean notify)
neuron - Type of neuron to addnotify - whether to notify listeners that this neuron has been addedpublic void addNeuron(Neuron neuron)
neuron - Type of neuron to addpublic int getWeightCount()
public Synapse getWeight(int index)
index - Number of weight in array list.
public double getTime()
public void setTime(double i)
i - the current timepublic String getTimeLabel()
public int getTimeType()
protected void addWeight(Synapse weight,
boolean notify)
weight - the weight object to addnotify - whether to notify listeners that a weight has been added.public void addWeight(Synapse weight)
weight - the weight object to addpublic void updateAllNeurons()
Neuron.update() for each neuron.
public void updateAllWeights()
Synapse.update() for each weight.
public void checkAllBounds()
Neuron.checkBounds() for each neuron, which makes sure the neuron has not exceeded its upper bound
or gone below its lower bound. TODO: Add or replace with normalization within bounds?
public void roundAll()
protected void deleteNeuron(Neuron toDelete,
boolean notify)
toDelete - neuron to deletenotify - notify listeners that this neuron has been deletedpublic void deleteNeuron(Neuron toDelete)
toDelete - neuron to delete
protected void deleteWeight(Synapse toDelete,
boolean notify)
toDelete - the weight to deletenotify - whether to fire a synapse deleted eventpublic void deleteWeight(Synapse toDelete)
toDelete - the weight to deletepublic void clearActivations()
public double[] getState()
public void setWeightsToZero()
public void randomizeNeurons()
public void randomizeWeights()
public static double round(double value,
int decimalPlace)
value - value to round offdecimalPlace - degree of precision
public String toString()
toString in class ObjectObjectpublic int getPrecision()
public boolean getRoundingOff()
public void setPrecision(int i)
i - Degeree to round off valuespublic void setRoundingOff(boolean b)
b - Round offpublic boolean isRoundOffActivationValues()
public void setRoundOffActivationValues(boolean roundOffActivationValues)
roundOffActivationValues - The roundOffActivationValues to set.public void setNeuronList(ArrayList neuronList)
neuronList - The neuronList to set.public void setWeightList(ArrayList weightList)
weightList - The weightList to set.public void addNeuronList(ArrayList neurons)
neurons - list of neurons to addpublic void setUpperBounds(double u)
u - Upper boundpublic void setLowerBounds(double l)
l - Lower bound
public static Synapse getWeight(Neuron src,
Neuron tar)
src - source neurontar - target neuron
public void changeNeuron(Neuron oldNeuron,
Neuron newNeuron)
oldNeuron - out with the oldnewNeuron - in with the new...
public void changeSynapse(Synapse oldSynapse,
Synapse newSynapse)
oldSynapse - out with the oldnewSynapse - in with the new...public void initParents()
public void updateTimeType()
public void updateTime()
public Synapse getWeight(int i,
int j)
i - Neuorn numberj - Weight to get
public Network getNetworkParent()
public Network getRoot()
public void setNetworkParent(Network parentNet)
parentNet - The parentNet to set.public double getTimeStep()
public void setTimeStep(double timeStep)
timeStep - The timeStep to set.public static String[] getUnits()
public String getId()
public void setId(String id)
id - the new id.public boolean getClampWeights()
public void setClampWeights(boolean clampWeights)
clampWeights - Weights to setpublic boolean getClampNeurons()
public void setClampNeurons(boolean clampNeurons)
clampNeurons - Neurons to setpublic void fireNeuronDeleted(Neuron deleted)
deleted - neuron which has been deletedpublic void fireCouplingChanged(Neuron n)
n - the Neuron whose coupling has changed.public void fireNetworkChanged()
public void fireClampChanged()
public void fireNeuronAdded(Neuron added)
added - neuron which was added
public void fireNeuronChanged(Neuron old,
Neuron changed)
old - the previous neuron, before the changechanged - the new, changed neuronpublic void fireSynapseAdded(Synapse added)
added - synapse which was addedpublic void fireSynapseDeleted(Synapse deleted)
deleted - synapse which was deleted
public void fireSynapseChanged(Synapse old,
Synapse changed)
old - old synapse, before the changechanged - new, changed synapsepublic void updateWorldListeners(World toCheck)
toCheck - the world which should be checked for live couplings.public void close()
public void setInteractionMode(InteractionMode interactionMode)
interactionMode.
This is a bound property.
interactionMode - interaction mode for this network panel, must not be nullpublic InteractionMode getInteractionMode()
public boolean isUpdateCompleted()
public void setUpdateCompleted(boolean b)
b - whether the network has been updated or not.public NetworkThread getNetworkThread()
public void setNetworkThread(NetworkThread networkThread)
networkThread - The networkThread to set.public Workspace getWorkspace()
public void setWorkspace(Workspace workspace)
workspace - The workspace to set.public ArrayList getCouplingList()
public boolean isRoot()
public HashSet getListenerList()
public void addNetwork(Network n)
n - Network type to add.public Network getNetwork(int i)
i - Network number to get.
public void deleteNetwork(Network toDelete)
toDelete - Network to be deletedpublic void addNetworkList(ArrayList networks)
networks - list of neurons to addpublic ArrayList getNetworkList()
public void setNetworkList(ArrayList networkList)
networkList - The networkList to set.public ArrayList getFlatNeuronList()
public ArrayList getFlatSynapseList()
public ArrayList getFlatNetworkList()
public void updateIds()
public Collection getInputNeurons()
public Collection getOutputNeurons()
public void fireSubnetAdded(Network added)
added - synapse which was addedpublic void fireSubnetDeleted(Network deleted)
deleted - synapse which was deletedpublic void addNetworkListener(NetworkListener l)
l - listener to addpublic void removeNetworkListener(NetworkListener l)
l - listener to remove
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||