CARLsim provides a set of pre-defined connection topologies, which may prove useful
when setting up networks. For a list of possibilities, refer to the Section
Making connections in the
Tutorial.
However, the user can also implement a topology of their choice by using a callback
mechanism.
The user can choose from a set of primitive pre-defined connection topologies, or he
can implement a topology of their choice by using a callback mechanism.
In the callback mechanism, the simulator calls a method on a user-defined class in order
to determine whether a connection should be made or not. The user simply needs to define
a method that specifies whether a connection should be made between a pre-synaptic
neuron and a post-synaptic neuron, and the simulator will automatically call the method
for all possible pre- and post-synaptic pairs. The user can then specify the
connection's delay, initial weight, maximum weight, and whether or not it is plastic.
To make a user-defined connection, the user starts by making a new class that derives
from the ConnectionGenerator class:
class MyConnection: public ConnectionGenerator { ...
The user must then specify a connect method.
^ConnectionGenerator::connect CARLsim ≥ 2.0
virtual void connect(CpuSNN* net, int srcGrp, int src, int destGrp, int dest,
float& weight, float& maxWt, float& delay,
bool& connected)
Input arguments:
CpuSNN* net: pointer to a CpuSNN object
int srcGrp: ID of pre-synaptic neuron group
int src: ID of neuron in pre-synaptic group
int destGrp: ID of post-synaptic neuron group
int dest: ID of neuron in post-synaptic group
Output arguments:
float& weight: weight of synapse that connects pre-neuron i to
post-neuron j
float& maxWt: maximum weight of synapse that connects pre-neuron i
to post-neuron j
float& delay: delay of synapse that connects pre-neuron i to
post-neuron j
bool connected: true if pre-neuron i should be connected to
post-neuron j, else false
Caution: The virtual method should never be called directly.
|