Nengo.ca

ca.nengo.model
Interface Network

All Superinterfaces:
java.lang.Cloneable, Node, Probeable, Resettable, java.io.Serializable, SimulationMode.ModeConfigurable, VisiblyMutable
All Known Implementing Classes:
NetworkArrayImpl, NetworkImpl, PyramidalNetwork

public interface Network
extends Node, Probeable

A neural circuit, consisting of Nodes such as Ensembles and ExternalInputs. A Network is the usual object of a simulation. If you are new to this code, what you probably want to do is create some Neurons, group them into Ensembles, connect the Ensembles in a Network, and run the Network in a Simulator.

Note: Multiple steps are needed to add a Projection between Ensembles. First, an Origin must be created on the presynaptic Ensemble, and a Termination with the same dimensionality must be created on the post-synaptic Ensemble. Then the Origin and Termination can be connected with the method addProjection(Origin, Termination). We don't do this in one step (ie automatically create the necessary Origin and Termination as needed) because there are various ways of doing so, and in fact some types of Origins and Terminations can only be created in the course of constructing the Ensemble. Creation of an Origin or Termination can also be a complex process. Rather than try to abstract these varied procedures into something that can be driven from the Network level, we just assume here that the necessary Origins and Terminations exist, and provide a method for connecting them.


Nested Class Summary
 
Nested classes/interfaces inherited from interface ca.nengo.util.VisiblyMutable
VisiblyMutable.Event, VisiblyMutable.Listener, VisiblyMutable.NameChangeEvent, VisiblyMutable.NodeRemovedEvent
 
Method Summary
 void addNode(Node node)
           
 Projection addProjection(Origin origin, Termination termination)
          Connects an Origin to a Termination.
 void addStepListener(StepListener listener)
           
 void exposeOrigin(Origin origin, java.lang.String name)
          Declares the given Origin as available for connection outside the Network via getOrigins().
 void exposeState(Probeable probeable, java.lang.String stateName, java.lang.String name)
          Declares the given Probeable state as being available for Probing from outside this Network.
 void exposeTermination(Termination termination, java.lang.String name)
          Declares the given Termination as available for connection from outside the Network via getTerminations().
 void fireStepListeners(float time)
           
 java.lang.String getExposedOriginName(Origin insideOrigin)
           
 java.lang.String getExposedTerminationName(Termination insideTermination)
           
 java.lang.Object getMetaData(java.lang.String key)
          Metadata is non-critical information about the Network (eg UI layout) that the user doesn't access directly.
 Node getNode(java.lang.String name)
           
 Node[] getNodes()
           
 Projection[] getProjections()
           
 Simulator getSimulator()
           
 void hideOrigin(java.lang.String name)
          Undoes exposeOrigin(x, x, name).
 void hideState(java.lang.String name)
          Undoes exposeState(x, x, name).
 void hideTermination(java.lang.String name)
          Undoes exposeTermination(x, x, name).
 void removeNode(java.lang.String name)
           
 void removeProjection(Termination termination)
           
 void removeStepListener(StepListener listener)
           
 void setMetaData(java.lang.String key, java.lang.Object value)
           
 void setSimulator(Simulator simulator)
           
 java.lang.String toPostScript(java.util.HashMap<java.lang.String,java.lang.Object> scriptData)
           
 
Methods inherited from interface ca.nengo.model.Node
clone, getChildren, getDocumentation, getName, getOrigin, getOrigins, getTermination, getTerminations, run, setDocumentation, setName, toScript
 
Methods inherited from interface ca.nengo.model.Resettable
reset
 
Methods inherited from interface ca.nengo.model.SimulationMode.ModeConfigurable
getMode, setMode
 
Methods inherited from interface ca.nengo.util.VisiblyMutable
addChangeListener, removeChangeListener
 
Methods inherited from interface ca.nengo.model.Probeable
getHistory, listStates
 

Method Detail

addNode

void addNode(Node node)
             throws StructuralException
Parameters:
node - Node to add to the Network
Throws:
StructuralException - if the Network already contains a Node of the same name

getNodes

Node[] getNodes()
Returns:
All the Nodes in the Network

getNode

Node getNode(java.lang.String name)
             throws StructuralException
Parameters:
name - Name of Node to remove
Returns:
Named node
Throws:
StructuralException - if named Node does not exist in network

removeNode

void removeNode(java.lang.String name)
                throws StructuralException
Parameters:
name - Name of Node to remove
Throws:
StructuralException - if named Node does not exist in network

addProjection

Projection addProjection(Origin origin,
                         Termination termination)
                         throws StructuralException
Connects an Origin to a Termination. Origins and Terminations belong to Ensembles (or ExternalInputs). Both the Origin and Termination must be set up before calling this method. The way to do this will depend on the Ensemble.

Parameters:
origin - Origin (data source) of Projection.
termination - Termination (data destination) of Projection.
Returns:
The created Projection
Throws:
StructuralException - if the given Origin and Termination have different dimensions, or if there is already an Origin connected to the given Termination (note that an Origin can project to multiple Terminations though).

getProjections

Projection[] getProjections()
Returns:
All Projections in this Network

removeProjection

void removeProjection(Termination termination)
                      throws StructuralException
Parameters:
termination - Termination of Projection to remove
Throws:
StructuralException - if there exists no Projection between the specified Origin and Termination

exposeOrigin

void exposeOrigin(Origin origin,
                  java.lang.String name)
Declares the given Origin as available for connection outside the Network via getOrigins(). This Origin should not be connected within this Network.

Parameters:
origin - An Origin within this Network that is to connect to something outside this Network
name - Name of the Origin as it will appear outside this Network

getExposedOriginName

java.lang.String getExposedOriginName(Origin insideOrigin)
Parameters:
insideOrigin - Origin inside the network
Returns:
Name of the exposed origin given the inner origin. null if no such origin is exposed.

hideOrigin

void hideOrigin(java.lang.String name)
                throws StructuralException
Undoes exposeOrigin(x, x, name).

Parameters:
name - Name of Origin to unexpose.
Throws:
StructuralException - if Origin does not exist

exposeTermination

void exposeTermination(Termination termination,
                       java.lang.String name)
Declares the given Termination as available for connection from outside the Network via getTerminations(). This Termination should not be connected within this Network.

Parameters:
termination - A Termination within this Network that is to connect to something outside this Network
name - Name of the Termination as it will appear outside this Network

hideTermination

void hideTermination(java.lang.String name)
Undoes exposeTermination(x, x, name).

Parameters:
name - Name of Termination to unexpose.

getExposedTerminationName

java.lang.String getExposedTerminationName(Termination insideTermination)
Parameters:
insideTermination - Termination inside the network
Returns:
Name of the exposed termination given the inner termination or null if no such termination is exposed.

exposeState

void exposeState(Probeable probeable,
                 java.lang.String stateName,
                 java.lang.String name)
                 throws StructuralException
Declares the given Probeable state as being available for Probing from outside this Network.

Parameters:
probeable - A Probeable within this Network.
stateName - A state of the given Probeable
name - A new name with which to access this state via Network.getHistory
Throws:
StructuralException - if Probeable not in the Network

hideState

void hideState(java.lang.String name)
Undoes exposeState(x, x, name).

Parameters:
name - Name of state to unexpose.

setSimulator

void setSimulator(Simulator simulator)
Parameters:
simulator - The Simulator used to run this Network

getSimulator

Simulator getSimulator()
Returns:
The Simulator used to run this Network

getMetaData

java.lang.Object getMetaData(java.lang.String key)
Metadata is non-critical information about the Network (eg UI layout) that the user doesn't access directly. (Note: if there is a need for user-accessible metadata, Network could extend Configurable, but this doesn't seem to be necessary.)

Parameters:
key - Name of a metadata item
Returns:
Value of a metadata item

setMetaData

void setMetaData(java.lang.String key,
                 java.lang.Object value)
Parameters:
key - Name of a metadata item
value - Value of the named metadata item

toPostScript

java.lang.String toPostScript(java.util.HashMap<java.lang.String,java.lang.Object> scriptData)
                              throws ScriptGenException
Parameters:
scriptData - Map of class parent and prefix data for generating python script
Returns:
Python script for generating special or template ensembles and terminations in the network
Throws:
ScriptGenException - if the node cannot be generated in script

addStepListener

void addStepListener(StepListener listener)

removeStepListener

void removeStepListener(StepListener listener)

fireStepListeners

void fireStepListeners(float time)

Nengo.ca