public class EnsembleImpl extends AbstractEnsemble implements ExpandableNode
Default implementation of Ensemble.
Origins or Terminations can be set up on Nodes before they are grouped into an Ensemble. After Nodes are added to an Ensemble, no Origins or Terminations should be added to them directly. Terminations can be added with EnsembleImpl.addTermination(...) If a Termination is added directly to a Node after the Node is added to the Ensemble, the Termination will not appear in Ensemble.getTerminations()
TODO: testVisiblyMutable.Event, VisiblyMutable.Listener, VisiblyMutable.NameChangeEvent, VisiblyMutable.NodeRemovedEvent
Modifier and Type | Field and Description |
---|---|
protected ExpandableNode[] |
myExpandableNodes |
protected java.util.Map<java.lang.String,Termination> |
myExpandedTerminations |
Constructor and Description |
---|
EnsembleImpl(java.lang.String name,
Node[] nodes) |
EnsembleImpl(java.lang.String name,
NodeFactory factory,
int n) |
Modifier and Type | Method and Description |
---|---|
Termination |
addTermination(java.lang.String name,
float[][] weights,
float tauPSC,
boolean modulatory)
Adds a new Termination onto this Node.
|
Termination |
addTermination(java.lang.String name,
float[][] weights,
PDF tauPSC,
PDF delays,
boolean modulatory) |
EnsembleImpl |
clone() |
Node[] |
getChildren() |
int |
getDimension() |
Termination |
getTermination(java.lang.String name) |
Termination[] |
getTerminations() |
void |
notifyAboutDeletion()
This method tells the Node (network) that is being deleted from Nengo,
Node can inform its children (child Nodes) that are being deleted,
these nodes can e.g.
|
Termination |
removeTermination(java.lang.String name) |
void |
reset(boolean randomize)
Resets each Node in this Ensemble.
|
void |
setMode(SimulationMode mode)
This Ensemble does not support SimulationMode.DIRECT.
|
java.lang.String |
toScript(java.util.HashMap<java.lang.String,java.lang.Object> scriptData) |
addChangeListener, collectSpikes, findCommon1DOrigins, fireVisibleChangeEvent, getCollectSpikesRatio, getDocumentation, getHistory, getMetadata, getMode, getName, getNodes, getOrigin, getOrigins, getSpikePattern, isCollectingSpikes, listStates, redefineNodes, removeChangeListener, removeOrigin, run, setCollectSpikesRatio, setDocumentation, setMetadata, setName, setSpikePattern, stopProbing
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDocumentation, getName, getOrigin, getOrigins, run, setDocumentation, setName
getMode
addChangeListener, removeChangeListener
protected ExpandableNode[] myExpandableNodes
protected java.util.Map<java.lang.String,Termination> myExpandedTerminations
public EnsembleImpl(java.lang.String name, Node[] nodes)
name
- Name of Ensemblenodes
- Nodes that make up the Ensemblepublic EnsembleImpl(java.lang.String name, NodeFactory factory, int n) throws StructuralException
name
- Name of Ensemblefactory
- Factory class that will create nodesn
- Number of nodes to createStructuralException
- if any problem halts constructionpublic Termination getTermination(java.lang.String name) throws StructuralException
getTermination
in interface Node
getTermination
in class AbstractEnsemble
name
- Name of a Termination onto this NodeStructuralException
- if the named Termination does not existNode.getTermination(java.lang.String)
public Termination[] getTerminations()
getTerminations
in interface Node
getTerminations
in class AbstractEnsemble
Node.getTerminations()
public void setMode(SimulationMode mode)
setMode
in interface SimulationMode.ModeConfigurable
setMode
in class AbstractEnsemble
mode
- SimulationMode in which it is desired that the object runs.SimulationMode.ModeConfigurable.setMode(ca.nengo.model.SimulationMode)
public Termination addTermination(java.lang.String name, float[][] weights, float tauPSC, boolean modulatory) throws StructuralException
ExpandableNode
addTermination
in interface ExpandableNode
weights
- Each row is used as a 1 by m matrix of weights in a new termination on the nth expandable nodename
- Unique name for the Termination (in the scope of this Node)tauPSC
- Time constant with which incoming signals are filtered. (All Terminations have
this property, but it may have slightly different interpretations per implementation.)modulatory
- If true, inputs to the Termination are not summed with other inputs (they
only have modulatory effects, eg on plasticity, which must be defined elsewhere).StructuralException
- if length of weights doesn't equal getDimension(),
or if there are different numbers of weights given in different rows.ExpandableNode.addTermination(java.lang.String, float[][], float, boolean)
public Termination addTermination(java.lang.String name, float[][] weights, PDF tauPSC, PDF delays, boolean modulatory) throws StructuralException
weights
- Each row is used as a 1 by m matrix of weights in a new termination on the nth expandable nodetauPSC
- PDF from which psc time constants will be sampledStructuralException
ExpandableNode.addTermination(java.lang.String, float[][], float, boolean)
public Termination removeTermination(java.lang.String name) throws StructuralException
removeTermination
in interface ExpandableNode
removeTermination
in class AbstractEnsemble
name
- Name of the Termination to remove from the ensembleStructuralException
- if Termination does not existExpandableNode.removeTermination(java.lang.String)
public int getDimension()
getDimension
in interface ExpandableNode
ExpandableNode.getDimension()
public EnsembleImpl clone() throws java.lang.CloneNotSupportedException
clone
in interface ExpandableNode
clone
in interface Node
clone
in class AbstractEnsemble
java.lang.CloneNotSupportedException
- if clone can't be madepublic void reset(boolean randomize)
AbstractEnsemble
reset
in interface Resettable
reset
in class AbstractEnsemble
randomize
- True indicates that the object should be reset to a
randomly selected initial state (the object must be aware of the
distribution from which to draw from). False indicates that the
object should be reset to a fixed initial state (which it must
also know). Some objects may not support randomization of the initial
state, in which case a fixed state will be used in either case.Resettable.reset(boolean)
public Node[] getChildren()
getChildren
in interface Node
public java.lang.String toScript(java.util.HashMap<java.lang.String,java.lang.Object> scriptData) throws ScriptGenException
toScript
in interface Node
scriptData
- Map of class parent and prefix data for generating python scriptScriptGenException
- if the node cannot be generated in scriptpublic void notifyAboutDeletion()
Node
notifyAboutDeletion
in interface Node