ca.nengo.sim.impl
Class LocalSimulator
java.lang.Object
ca.nengo.sim.impl.LocalSimulator
- All Implemented Interfaces:
- Simulator, VisiblyMutable, java.io.Serializable, java.lang.Cloneable
public class LocalSimulator
- extends java.lang.Object
- implements Simulator, java.io.Serializable
A Simulator that runs locally (ie in the Java Virtual Machine in which it is
called). TODO: test
- Author:
- Bryan Tripp
- See Also:
- Serialized Form
|
Method Summary |
void |
addChangeListener(VisiblyMutable.Listener listener)
|
Probe |
addProbe(java.lang.String ensembleName,
int neuronIndex,
java.lang.String state,
boolean record)
|
Probe |
addProbe(java.lang.String ensembleName,
Probeable target,
java.lang.String state,
boolean record)
|
Probe |
addProbe(java.lang.String nodeName,
java.lang.String state,
boolean record)
|
void |
addSimulatorListener(SimulatorListener listener)
|
Simulator |
clone()
|
protected void |
fireSimulatorEvent(SimulatorEvent event)
|
Probe[] |
getProbes()
|
void |
initialize(Network network)
Initializes the Simulator with a given Network, after which changes to the
Network MAY OR MAY NOT BE IGNORED. |
void |
removeChangeListener(VisiblyMutable.Listener listener)
|
void |
removeProbe(Probe probe)
|
void |
removeSimulatorListener(SimulatorListener listener)
|
void |
resetNetwork(boolean randomize)
Resets all Nodes in the simulated Network. |
void |
run(float startTime,
float endTime,
float stepSize)
Runs the Network for the given time range. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LocalSimulator
public LocalSimulator()
initialize
public void initialize(Network network)
- Description copied from interface:
Simulator
- Initializes the Simulator with a given Network, after which changes to the
Network MAY OR MAY NOT BE IGNORED. This is because the Simulator is free to
either run the given Neurons/Ensembles, or to make copies of them and run
the copies. (The latter is likely in a clustered implementation.) If you make
changes to the Network after initializing a Simulator with it, initialize
again. If you want the Network to change somehow mid-simulation (e.g. you
want to remove some neurons from an Ensemble to test robustness), these
changes should be performed by the Ensembles or Neurons themselves, i.e. they
should be an explicit part of the model.
- Specified by:
initialize in interface Simulator
- Parameters:
network - Network to set up for simulation- See Also:
Simulator.initialize(ca.nengo.model.Network)
run
public void run(float startTime,
float endTime,
float stepSize)
throws SimulationException
- Description copied from interface:
Simulator
- Runs the Network for the given time range. The states of all components of the
Network are assumed to be consistent with the given start time. So, you could
reset to the t=0 state, and then immediately start running from t=100, but the
results may not make sense.
- Specified by:
run in interface Simulator
- Parameters:
startTime - Simulation time at which running startsendTime - Simulation time at which running stopsstepSize - Length of time step at which the Network is run. This determines the
frequency with which outputs are passed between Ensembles, but individual
Neurons may run with different and/or variable time steps.
- Throws:
SimulationException - if a problem is encountered while trying to run- See Also:
Simulator.run(float, float, float)
resetNetwork
public void resetNetwork(boolean randomize)
- Description copied from interface:
Simulator
- Resets all Nodes in the simulated Network.
- Specified by:
resetNetwork in interface Simulator
- Parameters:
randomize - True indicates reset to random initial condition (see
Resettable.reset(boolean)).- See Also:
Simulator.resetNetwork(boolean)
addProbe
public Probe addProbe(java.lang.String nodeName,
java.lang.String state,
boolean record)
throws SimulationException
- Specified by:
addProbe in interface Simulator
- Parameters:
nodeName - Name of a Probeable Node from which state is to be probedstate - The name of the state variable to proberecord - Probe retains history if true
- Returns:
- A Probe connected to the specified Node
- Throws:
SimulationException - if the referenced Node can not be found, or is not Probeable, or does
not have the specified state variable- See Also:
Simulator.addProbe(java.lang.String, java.lang.String,
boolean)
addProbe
public Probe addProbe(java.lang.String ensembleName,
int neuronIndex,
java.lang.String state,
boolean record)
throws SimulationException
- Specified by:
addProbe in interface Simulator
- Parameters:
ensembleName - Name of Ensemble containing a Probeable Neuron from which state is to be probedneuronIndex - Index of the Neuron (from 0) within the specified Ensemblestate - The name of the state variable to proberecord - Probe retains history if true
- Returns:
- A Probe connected to the specified Neuron
- Throws:
SimulationException - if the referenced Neuron can not be found, or is not Probeable, or does
not have the specified state variable- See Also:
Simulator.addProbe(java.lang.String, int,
java.lang.String, boolean)
addProbe
public Probe addProbe(java.lang.String ensembleName,
Probeable target,
java.lang.String state,
boolean record)
throws SimulationException
- Specified by:
addProbe in interface Simulator
- Parameters:
ensembleName - Name of Ensemble the target belongs to. Null, if the target is
a top-level nodetarget - Probeable targetstate - The name of the state variable to proberecord - Probe retains history if true
- Returns:
- A Probe connected to the specified Neuron
- Throws:
SimulationException - if the referenced Neuron can not be found, or is not
Probeable, or does not have the specified state variable- See Also:
Simulator.addProbe(java.lang.String, int,
java.lang.String, boolean)
removeProbe
public void removeProbe(Probe probe)
throws SimulationException
- Specified by:
removeProbe in interface Simulator
- Parameters:
probe - Probe to be removed
- Throws:
SimulationException - if the referenced probe cannot be removed- See Also:
Simulator.removeProbe(ca.nengo.util.Probe)
getProbes
public Probe[] getProbes()
- Specified by:
getProbes in interface Simulator
- Returns:
- List of Probes that have been added to this Simulator.
- See Also:
Simulator.getProbes()
addSimulatorListener
public void addSimulatorListener(SimulatorListener listener)
- Specified by:
addSimulatorListener in interface Simulator
- Parameters:
listener - A Simulator listener to be added- See Also:
Simulator.addSimulatorListener(ca.nengo.sim.SimulatorListener)
fireSimulatorEvent
protected void fireSimulatorEvent(SimulatorEvent event)
- Parameters:
event -
removeSimulatorListener
public void removeSimulatorListener(SimulatorListener listener)
- Specified by:
removeSimulatorListener in interface Simulator
- Parameters:
listener - A Simulator listener to be removed- See Also:
Simulator.removeSimulatorListener(ca.nengo.sim.SimulatorListener)
addChangeListener
public void addChangeListener(VisiblyMutable.Listener listener)
- Specified by:
addChangeListener in interface VisiblyMutable
- Parameters:
listener - Listener to add- See Also:
VisiblyMutable.addChangeListener(ca.nengo.util.VisiblyMutable.Listener)
removeChangeListener
public void removeChangeListener(VisiblyMutable.Listener listener)
- Specified by:
removeChangeListener in interface VisiblyMutable
- Parameters:
listener - Listener to remove- See Also:
VisiblyMutable.removeChangeListener(ca.nengo.util.VisiblyMutable.Listener)
clone
public Simulator clone()
throws java.lang.CloneNotSupportedException
- Specified by:
clone in interface Simulator- Overrides:
clone in class java.lang.Object
- Returns:
- An independent copy of the Simulator. The copy has the same type and parameters,
but doesn't reference any Network, contain any Probes, or have any SimulatorListeners
- Throws:
java.lang.CloneNotSupportedException