public class LocalSimulator extends java.lang.Object implements Simulator, java.io.Serializable
VisiblyMutable.Event, VisiblyMutable.Listener, VisiblyMutable.NameChangeEvent, VisiblyMutable.NodeRemovedEvent
Constructor and Description |
---|
LocalSimulator() |
Modifier and Type | Method and Description |
---|---|
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() |
void |
endRun() |
protected void |
fireSimulatorEvent(SimulatorEvent event) |
NodeThreadPool |
getNodeThreadPool() |
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 |
initRun(boolean interactive)
Setup the run.
|
void |
makeNodeThreadPool(boolean interactive) |
void |
removeChangeListener(VisiblyMutable.Listener listener) |
void |
removeProbe(Probe probe) |
void |
removeSimulatorListener(SimulatorListener listener) |
void |
resetNetwork(boolean randomize,
boolean saveWeights)
Resets all Nodes in the simulated Network.
|
void |
resetProbes()
Resets all probes in the network, recursively including subnetworks.
|
void |
run(float startTime,
float endTime,
float stepSize)
Runs the Network for the given time range.
|
void |
run(float startTime,
float endTime,
float stepSize,
boolean topLevel)
Run function with option to display (or not) the progress in the console
|
void |
setDisplayProgress(boolean display) |
void |
step(float startTime,
float endTime) |
public void initialize(Network network)
Simulator
initialize
in interface Simulator
network
- Network to set up for simulationSimulator.initialize(ca.nengo.model.Network)
public void resetProbes()
Simulator
resetProbes
in interface Simulator
Simulator.resetProbes()
public void initRun(boolean interactive)
public void run(float startTime, float endTime, float stepSize) throws SimulationException
Simulator
run
in interface Simulator
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.SimulationException
- if a problem is encountered while trying to runSimulator.run(float, float, float)
public void run(float startTime, float endTime, float stepSize, boolean topLevel) throws SimulationException
run
in interface Simulator
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.topLevel
- true if the network being run is the top level network, false if it
is a subnetworkSimulationException
- if a problem is encountered while trying to runpublic void step(float startTime, float endTime) throws SimulationException
SimulationException
public void endRun()
public void resetNetwork(boolean randomize, boolean saveWeights)
Simulator
resetNetwork
in interface Simulator
randomize
- True indicates reset to random initial condition (see
Resettable.reset(boolean)).saveWeights
- True indicates that the weights on
LinearExponentialTerminations should be saved rather than resetSimulator.resetNetwork(boolean, boolean)
public Probe addProbe(java.lang.String nodeName, java.lang.String state, boolean record) throws SimulationException
addProbe
in interface Simulator
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 trueSimulationException
- if the referenced Node can not be found, or is not Probeable, or does
not have the specified state variableSimulator.addProbe(java.lang.String, java.lang.String,
boolean)
public Probe addProbe(java.lang.String ensembleName, int neuronIndex, java.lang.String state, boolean record) throws SimulationException
addProbe
in interface Simulator
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 trueSimulationException
- if the referenced Neuron can not be found, or is not Probeable, or does
not have the specified state variableSimulator.addProbe(java.lang.String, int,
java.lang.String, boolean)
public Probe addProbe(java.lang.String ensembleName, Probeable target, java.lang.String state, boolean record) throws SimulationException
addProbe
in interface Simulator
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 trueSimulationException
- if the referenced Neuron can not be found, or is not
Probeable, or does not have the specified state variableSimulator.addProbe(java.lang.String, int,
java.lang.String, boolean)
public void removeProbe(Probe probe) throws SimulationException
removeProbe
in interface Simulator
probe
- Probe to be removedSimulationException
- if the referenced probe cannot be removedSimulator.removeProbe(ca.nengo.util.Probe)
public Probe[] getProbes()
getProbes
in interface Simulator
Simulator.getProbes()
public void makeNodeThreadPool(boolean interactive)
public NodeThreadPool getNodeThreadPool()
public void setDisplayProgress(boolean display)
public void addSimulatorListener(SimulatorListener listener)
addSimulatorListener
in interface Simulator
listener
- A Simulator listener to be addedSimulator.addSimulatorListener(ca.nengo.sim.SimulatorListener)
protected void fireSimulatorEvent(SimulatorEvent event)
event
- public void removeSimulatorListener(SimulatorListener listener)
removeSimulatorListener
in interface Simulator
listener
- A Simulator listener to be removedSimulator.removeSimulatorListener(ca.nengo.sim.SimulatorListener)
public void addChangeListener(VisiblyMutable.Listener listener)
addChangeListener
in interface VisiblyMutable
listener
- Listener to addVisiblyMutable.addChangeListener(ca.nengo.util.VisiblyMutable.Listener)
public void removeChangeListener(VisiblyMutable.Listener listener)
removeChangeListener
in interface VisiblyMutable
listener
- Listener to removeVisiblyMutable.removeChangeListener(ca.nengo.util.VisiblyMutable.Listener)
public Simulator clone() throws java.lang.CloneNotSupportedException
clone
in interface Simulator
clone
in class java.lang.Object
java.lang.CloneNotSupportedException