ca.nengo.model.impl
Class EnsembleImpl
java.lang.Object
ca.nengo.model.impl.AbstractEnsemble
ca.nengo.model.impl.EnsembleImpl
- All Implemented Interfaces:
- Ensemble, ExpandableNode, Node, Plastic, Probeable, Resettable, SimulationMode.ModeConfigurable, VisiblyMutable, java.io.Serializable, java.lang.Cloneable
- Direct Known Subclasses:
- DecodableEnsembleImpl
public class EnsembleImpl
- extends AbstractEnsemble
- implements ExpandableNode, Plastic
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: test
- Author:
- Bryan Tripp
- See Also:
- Serialized Form
| Methods inherited from class ca.nengo.model.impl.AbstractEnsemble |
addChangeListener, collectSpikes, findCommon1DOrigins, fireVisibleChangeEvent, getCollectSpikesRatio, getDocumentation, getHistory, getMode, getName, getNodes, getOrigin, getOrigins, getSpikePattern, isCollectingSpikes, listStates, removeChangeListener, reset, run, setCollectSpikesRatio, setDocumentation, setName |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EnsembleImpl
public EnsembleImpl(java.lang.String name,
Node[] nodes)
throws StructuralException
- Parameters:
name - Name of Ensemblenodes - Nodes that make up the Ensemble
- Throws:
StructuralException - if the given Nodes contain Terminations with the same
name but different dimensions
EnsembleImpl
public EnsembleImpl(java.lang.String name,
NodeFactory factory,
int n)
throws StructuralException
- Throws:
StructuralException
getTerminations
public Termination[] getTerminations()
- Specified by:
getTerminations in interface Node- Overrides:
getTerminations in class AbstractEnsemble
- Returns:
- Sets of input channels (these have the same dimension as corresponding Origins
to which they are connected).
- See Also:
Node.getTerminations()
setMode
public void setMode(SimulationMode mode)
- This Ensemble does not support SimulationMode.DIRECT.
- Specified by:
setMode in interface SimulationMode.ModeConfigurable- Overrides:
setMode in class AbstractEnsemble
- Parameters:
mode - SimulationMode in which it is desired that the object runs.- See Also:
SimulationMode.ModeConfigurable.setMode(ca.nengo.model.SimulationMode)
addTermination
public Termination addTermination(java.lang.String name,
float[][] weights,
float tauPSC,
boolean modulatory)
throws StructuralException
- Description copied from interface:
ExpandableNode
- Adds a new Termination onto this Node.
- Specified by:
addTermination in interface ExpandableNode
- Parameters:
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).
- Returns:
- resulting Termination
- Throws:
StructuralException - if length of weights doesn't equal getDimension(),
or if there are different numbers of weights given in different rows.- See Also:
ExpandableNode.addTermination(java.lang.String, float[][], float, boolean)
removeTermination
public void removeTermination(java.lang.String name)
throws StructuralException
- Specified by:
removeTermination in interface ExpandableNode
- Parameters:
name - Name of Termination to remove.
- Throws:
StructuralException- See Also:
ExpandableNode.removeTermination(java.lang.String)
getDimension
public int getDimension()
- Specified by:
getDimension in interface ExpandableNode
- Returns:
- Output dimension of Terminations onto this Node
- See Also:
ExpandableNode.getDimension()
getTermination
public Termination getTermination(java.lang.String name)
throws StructuralException
- Specified by:
getTermination in interface Node- Overrides:
getTermination in class AbstractEnsemble
- Parameters:
name - Name of a Termination onto this Node
- Returns:
- The named Termination if it exists
- Throws:
StructuralException - if the named Termination does not exist- See Also:
Node.getTermination(java.lang.String)
setPlasticityRule
public void setPlasticityRule(java.lang.String terminationName,
PlasticityRule rule)
throws StructuralException
- Sets the given plasticity rule for all Plastic Nodes in the Ensemble.
- Specified by:
setPlasticityRule in interface Plastic
- Parameters:
terminationName - Name of termination to which plasticity rule applies.rule - A rule that defines how the termination's transformation matrix elements change during simulation
- Throws:
StructuralException - if the named Termination does not exist- See Also:
Plastic.setPlasticityRule(java.lang.String, ca.nengo.model.plasticity.PlasticityRule)
setPlasticityInterval
public void setPlasticityInterval(float time)
- Specified by:
setPlasticityInterval in interface Plastic
- Parameters:
time - Period after which plasticity rules are evaluated (defaults to every time step).- See Also:
Plastic.setPlasticityInterval(float)
getPlasticityInterval
public float getPlasticityInterval()
- Returns minimum of plasticity intervals of plastic component nodes, or -1 if
none of the component nodes are plastic.
- Specified by:
getPlasticityInterval in interface Plastic
- Returns:
- Period after which plasticity rules are evaluated (defaults to every time step).
- See Also:
Plastic.getPlasticityInterval()
getPlasticityRule
public PlasticityRule getPlasticityRule(java.lang.String terminationName)
throws StructuralException
- Specified by:
getPlasticityRule in interface Plastic
- Parameters:
terminationName - Name of termination to which plasticity rule applies.
- Returns:
- A rule that defines how the termination's transformation matrix elements change during simulation
- Throws:
StructuralException - if the named Termination does not exist- See Also:
Plastic.getPlasticityRule(java.lang.String)
getPlasticityRuleNames
public java.lang.String[] getPlasticityRuleNames()
- Specified by:
getPlasticityRuleNames in interface Plastic
- Returns:
- Names of Terminations for which plasticity rules can be set
- See Also:
Plastic.getPlasticityRuleNames()
clone
public Ensemble clone()
throws java.lang.CloneNotSupportedException
- Specified by:
clone in interface Node- Overrides:
clone in class AbstractEnsemble
- Returns:
- An independent copy of the Node
- Throws:
java.lang.CloneNotSupportedException