public abstract class Module
extends java.lang.Object
implements java.io.Serializable
Module
interface. Standard behaviors like the get, set, add, remove methods are
defined here. This class also provides basic graph calculation. The developer
need only subclass this class and implement calculateOneTimeStep and define
its own important methods.Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.lang.Double> |
activities
Array with the activities of the individual neurons.
|
protected java.util.List<java.lang.Double> |
biases
Array with the activities of the individual neurons.
|
protected javax.swing.event.EventListenerList |
changeListeners
Listeners to be notified of module changes.
|
protected double |
elapsedTime
The time elapsed for this module.
|
protected long |
elapsedTimeSteps
The number of time steps elapsed for this module.
|
protected java.util.Map<Module,java.lang.String> |
forwardModules
HashMap with string-identifiers and identifier of the receiving port of the
target module.
|
static int |
GENERALIZED_HEBBIAN_LEARNING |
static int |
HEBBIAN_LEARNING |
static int |
OJAS_RULE_LEARNING |
protected java.util.HashMap<java.lang.String,java.lang.Double> |
receptors
HashMap with string-identifiers encoding the open ports for the individual
receptors.
|
Constructor and Description |
---|
Module() |
Modifier and Type | Method and Description |
---|---|
void |
addAfferentModule(Module afferentModule)
Adds a module to the HashMap `afferentModules'.
|
void |
addAfferentModule(Module afferentModule,
double defaultLink)
Adds a module to the HashMap `afferentModules'.
|
void |
addBias(double bias) |
void |
addBias(int index,
double bias) |
void |
addChangeListener(javax.swing.event.ChangeListener listener) |
void |
addForwardModule(Module module,
java.lang.String whichPort) |
void |
addNeuron(double activity) |
void |
addReceptor(java.lang.String receptorType,
double addValue)
Adds contribution `addValue' to the specified receptor field, returning
`false' if specified receptor does not exist.
|
protected abstract void |
calculateOneTimeStep(double timeDelta)
calculates one time step of the simulation calculation
This method has to be implemented by subclasses.
|
void |
exportGraphMLGraph(java.io.File graphmlFile) |
void |
exportGraphvizGraph(java.io.File gvFile) |
void |
exportGraphvizGraph(java.io.File gvFile,
double lowerLinkBound,
double upperLinkBound) |
void |
exportTGFGraph(java.io.File tgfFile)
http://en.wikipedia.org/wiki/Trivial_Graph_Format
|
void |
exportXfigCircle(java.io.File file)
Prints the xfig representation of one module with the vertices arranged on
a circle.
|
void |
exportXfigLattice(java.io.File file)
Prints the xfig representation of one module with the vertices arranged on
a two dimensional square lattice.
|
java.util.Set<java.lang.Integer> |
getActiveClique()
Returns the currently active clique of the graph.
|
java.util.List<java.lang.Double> |
getActivities()
Returns the activities levels.
|
double |
getActivity(int i)
Returns the activities level of a given center.
|
double |
getAfferentLink(Module afferentModule,
int i,
int j) |
java.util.List<java.util.List<java.lang.Double>> |
getAfferentLinks(Module afferentModule) |
java.util.Set<Module> |
getAfferentModules()
Returns all afferent modules.
|
double |
getAverageCoordinationNumber() |
double |
getBias(int index) |
java.util.List<java.lang.Double> |
getBiases() |
java.util.List<java.util.List<java.lang.Double>> |
getCliqueGraph()
returns the clique graph of the graph as an adjacency matrix
|
java.util.Set<java.util.Set<java.lang.Integer>> |
getCliques()
Returns the cliques of the graph.
|
java.util.Set<java.util.Set<java.lang.Integer>> |
getConnectedComponents() |
java.util.Map<java.lang.Integer,java.lang.Integer> |
getDegreeDistribution()
Returns the degree distribution of the graph.
|
double |
getElapsedTime()
returns the time elapsed
|
long |
getElapsedTimeSteps()
returns the number of time steps elapsed
|
Module[] |
getForwardModules()
Returns all forward module names as an ArrayList of Strings.
|
double |
getLearningRate(int neuron) |
java.util.List<java.lang.Double> |
getLearningRates() |
int |
getLearningType() |
double |
getLink(int i,
int j)
Gets the link w_ij (i ← j).
|
double |
getLinkProbability() |
java.util.List<java.util.List<java.lang.Double>> |
getLinks()
Gets the links w_ij (i ← j).
|
java.lang.String |
getName() |
java.util.List<java.util.Set<java.lang.Integer>> |
getNeighbors()
returns all the neighbors of all the vertices
|
java.util.Set<java.lang.Integer> |
getNeighbors(int neuron)
returns all the neighbors of a vertex It considers positive links only and
no autapses.
|
int |
getNodeDegree(int node)
Returns the degrees of the vertices.
|
java.util.List<java.lang.Integer> |
getNodeDegrees()
Returns the degrees of the vertices.
|
int |
getNodeInDegree(int node,
int sign) |
java.util.List<java.lang.Integer> |
getNodeInDegrees(int sign)
Returns the degrees of the vertices.
|
int |
getNodeOutDegree(int node,
int sign) |
java.util.List<java.lang.Integer> |
getNodeOutDegrees(int sign)
Returns the degrees of the vertices.
|
double |
getPositiveLinkAverage()
Gets the average positive links.
|
double |
getReceptor(java.lang.String receptorType)
Returns the value of the specified receptor field.
|
java.util.Map<java.lang.String,java.lang.Double> |
getReceptors() |
int |
getSize()
Gets the number of nodes.
|
boolean |
hasAfferentModule(Module module) |
boolean |
hasForwardModule(Module module) |
boolean |
isClique(java.util.Set<java.lang.Integer> cluster)
Determines whether a given cluster is a maximal clique.
|
boolean |
isLearning() |
void |
learning(double timeDelta) |
void |
multiplyExhibitoryAndInhibitoryLinksSeparately(double exhibitoryFactor,
double inhibitoryFactor) |
protected void |
notifyStateChanged(javax.swing.event.ChangeEvent event) |
void |
performOneTimeStep(double timeDelta)
performs one time step of the simulation calculation
|
void |
printLogFileHeader(java.io.PrintWriter out)
Prints a file header for the log files.
|
void |
removeAfferentModule(Module afferentModule) |
void |
removeAfferentModules() |
void |
removeChangeListener(javax.swing.event.ChangeListener listener) |
void |
removeForwardModule(Module module)
Removes a particular forward module from the HashMap of forward modules.
|
void |
removeForwardModules()
Remove all forward modules from the HashMap of forward modules.
|
void |
removeNeuron(int index) |
void |
reset() |
void |
setActivities(java.util.List<java.lang.Double> activities)
Sets the activities levels.
|
void |
setActivities(java.util.Set<java.lang.Integer> neurons,
double activeActivity,
double inactiveActivity)
Sets the activity of all the given neurons to the given value and the
activities of all the other neurons to the other given value.
|
void |
setActivity(int index,
double activity)
Sets the activity level of a given center.
|
void |
setAfferentLink(Module afferentModule,
int i,
int j,
double afferentLink) |
void |
setAfferentLinks(Module afferentModule,
double afferentLink) |
void |
setAfferentLinks(Module afferentModule,
java.util.List<java.util.List<java.lang.Double>> afferentLinks) |
void |
setBias(double bias) |
void |
setBias(int index,
double bias) |
void |
setLearning(boolean isLearning) |
void |
setLearningRates(double learningRate) |
void |
setLearningRates(int neuron,
double learningRate) |
void |
setLearningType(int learningType) |
void |
setLink(int i,
int j,
double value)
Sets the link w_ij (i ← j).
|
void |
setLink(int i,
int j,
double value,
boolean symmetric)
Sets the link w_ij (i ← j) and w_ji (i → j) if symmetric is true.
|
void |
setLinks(double[][] w)
Sets the links $w$.
|
void |
setName(java.lang.String name) |
void |
setNegativeLinks(double value)
Sets the negative links.
|
void |
setPositiveLinkAverage(double value)
Sets the positive link average by rescaling all the positive links.
|
void |
setPositiveLinks(double value)
Sets the positive links.
|
void |
setSize(int size)
Sets the number of nodes.
|
java.lang.String |
toString() |
void |
writeGraphvizSubgraph(java.io.PrintWriter out) |
void |
writeGraphvizSubgraph(java.io.PrintWriter out,
double lowerLinkBound,
double upperLinkBound) |
protected transient javax.swing.event.EventListenerList changeListeners
protected java.util.Map<Module,java.lang.String> forwardModules
The geometry of the forward connection, specific to the `DhanModule'
module. The receiving port (receptors for the neuromodulator) is given by
the second argument of `forwardModules'.
protected java.util.List<java.lang.Double> activities
protected java.util.List<java.lang.Double> biases
public static final int HEBBIAN_LEARNING
public static final int OJAS_RULE_LEARNING
public static final int GENERALIZED_HEBBIAN_LEARNING
protected java.util.HashMap<java.lang.String,java.lang.Double> receptors
The receptors are targeted by the diffusive module signals of other (or
this) modules, via the respective forward connection, stored in the
respective `forwardModules'.
The allowed types of receptors, the cues of the HashMap, are stored in
`auxMyReceptorsAllowedValues'.
protected transient long elapsedTimeSteps
protected transient double elapsedTime
public long getElapsedTimeSteps()
public double getElapsedTime()
public final void performOneTimeStep(double timeDelta)
protected abstract void calculateOneTimeStep(double timeDelta)
timeDelta
- public void addNeuron(double activity)
public void learning(double timeDelta)
public boolean isLearning()
public void setLearning(boolean isLearning)
public double getLearningRate(int neuron)
public java.util.List<java.lang.Double> getLearningRates()
public int getLearningType()
public void setLearningRates(double learningRate)
public void setLearningRates(int neuron, double learningRate)
public void setLearningType(int learningType)
public void removeNeuron(int index)
public java.util.List<java.lang.Double> getActivities()
public void setActivities(java.util.List<java.lang.Double> activities)
public double getActivity(int i)
public void setActivity(int index, double activity)
public void setActivities(java.util.Set<java.lang.Integer> neurons, double activeActivity, double inactiveActivity)
neurons
- the set of neurons to set the activities to using the first
valueactiveActivity
- activity for the neurons specifiedinactiveActivity
- activity for the complement of the neurons
specifiedpublic int getSize()
public void setSize(int size)
public double getLink(int i, int j)
i
- j
- public java.util.List<java.util.List<java.lang.Double>> getLinks()
public double getPositiveLinkAverage()
public void setNegativeLinks(double value)
value
- new link for each of the currently negative linkspublic void setPositiveLinks(double value)
value
- new link for each of the currently positive linkspublic void setPositiveLinkAverage(double value)
value
- public void setLink(int i, int j, double value)
i
- j
- value
- public void setLink(int i, int j, double value, boolean symmetric)
i
- j
- value
- symmetric
- public void setLinks(double[][] w)
w
- weighted adjacency matrixpublic void multiplyExhibitoryAndInhibitoryLinksSeparately(double exhibitoryFactor, double inhibitoryFactor)
public double getLinkProbability()
public void addAfferentModule(Module afferentModule, double defaultLink)
afferentModule
- - the module to which this module connectspublic void addAfferentModule(Module afferentModule)
afferentModule
- - the module to which this module connectspublic java.util.Set<Module> getAfferentModules()
public void removeAfferentModule(Module afferentModule)
public void removeAfferentModules()
public boolean hasAfferentModule(Module module)
public java.util.List<java.util.List<java.lang.Double>> getAfferentLinks(Module afferentModule)
public void setAfferentLinks(Module afferentModule, java.util.List<java.util.List<java.lang.Double>> afferentLinks)
public double getAfferentLink(Module afferentModule, int i, int j)
public void setAfferentLink(Module afferentModule, int i, int j, double afferentLink)
public void setAfferentLinks(Module afferentModule, double afferentLink)
public void addForwardModule(Module module, java.lang.String whichPort)
public Module[] getForwardModules()
--class DhanModule--
public void removeForwardModule(Module module)
--class DhanModule--
module
- name of module to removepublic void removeForwardModules()
--class DhanModule--
public boolean hasForwardModule(Module module)
public void addReceptor(java.lang.String receptorType, double addValue)
public double getReceptor(java.lang.String receptorType)
public java.util.Map<java.lang.String,java.lang.Double> getReceptors()
public java.lang.String toString()
toString
in class java.lang.Object
public void addChangeListener(javax.swing.event.ChangeListener listener)
public void removeChangeListener(javax.swing.event.ChangeListener listener)
protected void notifyStateChanged(javax.swing.event.ChangeEvent event)
public double getAverageCoordinationNumber()
public int getNodeDegree(int node)
public int getNodeInDegree(int node, int sign)
public int getNodeOutDegree(int node, int sign)
public java.util.List<java.lang.Integer> getNodeDegrees()
public java.util.List<java.lang.Integer> getNodeInDegrees(int sign)
public java.util.List<java.lang.Integer> getNodeOutDegrees(int sign)
public java.util.Map<java.lang.Integer,java.lang.Integer> getDegreeDistribution()
public java.util.Set<java.util.Set<java.lang.Integer>> getCliques()
public boolean isClique(java.util.Set<java.lang.Integer> cluster)
public java.util.List<java.util.Set<java.lang.Integer>> getNeighbors()
public java.util.Set<java.lang.Integer> getNeighbors(int neuron)
public java.util.Set<java.lang.Integer> getActiveClique()
public java.util.List<java.util.List<java.lang.Double>> getCliqueGraph()
public void exportTGFGraph(java.io.File tgfFile) throws java.io.FileNotFoundException
tgfFile
- java.io.FileNotFoundException
public void exportGraphMLGraph(java.io.File graphmlFile) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void exportGraphvizGraph(java.io.File gvFile) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void exportGraphvizGraph(java.io.File gvFile, double lowerLinkBound, double upperLinkBound) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void writeGraphvizSubgraph(java.io.PrintWriter out)
public void writeGraphvizSubgraph(java.io.PrintWriter out, double lowerLinkBound, double upperLinkBound)
public void exportXfigCircle(java.io.File file) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void exportXfigLattice(java.io.File file) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public java.lang.String getName()
public void setName(java.lang.String name)
public void addBias(double bias)
public void addBias(int index, double bias)
public double getBias(int index)
public java.util.List<java.lang.Double> getBiases()
public void setBias(double bias)
public void setBias(int index, double bias)
public void reset()
public java.util.Set<java.util.Set<java.lang.Integer>> getConnectedComponents()
public void printLogFileHeader(java.io.PrintWriter out)