Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
Macros | Functions
sim_isp_orig.cpp File Reference

This simulation illustrates inhibitory synaptic plasticity as modeled in Vogels et al. (2011) More...

#include "auryn.h"
Include dependency graph for sim_isp_orig.cpp:

Macros

#define NE   8000
 Number of excitatory neurons. More...
 
#define NI   2000
 Number of inhibitory neurons. More...
 
#define NP   1000
 Number of Poisson input neurons. More...
 

Functions

int main (int ac, char *av[])
 

Detailed Description

This simulation illustrates inhibitory synaptic plasticity as modeled in Vogels et al. (2011)

This simulation illustrates inhibitory synapitc plasticity as modeled in our paper: Vogels, T.P., Sprekeler, H., Zenke, F., Clopath, C., and Gerstner, W. (2011). Inhibitory Plasticity Balances Excitation and Inhibition in Sensory Pathways and Memory Networks. Science 334, 1569–1573.

Note that this is a parallel implementation of this network which requires a larger axonal delay than in the original paper. In this example the delay is 0.8ms which corresponds to Auryn's MINDELAY.

Macro Definition Documentation

◆ NE

#define NE   8000

Number of excitatory neurons.

◆ NI

#define NI   2000

Number of inhibitory neurons.

◆ NP

#define NP   1000

Number of Poisson input neurons.

Function Documentation

◆ main()

int main ( int  ac,
char *  av[] 
)
47 {
48  double w = 0.3 ;
49  double w_ext = w ;
50  double gamma = 10. ;
51  double wmax = 10*gamma*w;
52 
53  double sparseness = 0.02 ;
54  NeuronID seed = 1;
55 
56  double eta = 1e-4 ;
57  double kappa = 3. ;
58  double tau_stdp = 20e-3 ;
59  bool stdp_active = false;
60  bool poisson_stim = false;
61  double winh = -1;
62  double wei = 1;
63  double chi = 10.;
64  double bg_current = 2e-2;
65 
66  double poisson_rate = 100.;
67  double sparseness_afferents = 0.05;
68 
69  bool quiet = false;
70  double simtime = 1000. ;
71  NeuronID record_neuron = 30;
72  // handle command line options
73 
74  string infilename = "";
75  string outputfile = "out";
76  string netstatfile = "";
77  string stimfile = "";
78  string strbuf ;
79 
80  int errcode = 0;
81 
82  try {
83 
84  po::options_description desc("Allowed options");
85  desc.add_options()
86  ("help", "produce help message")
87  ("quiet", "quiet mode")
88  ("load", po::value<string>(), "input weight matrix")
89  ("out", po::value<string>(), "output filename")
90  ("stimfile", po::value<string>(), "stimulus file")
91  ("eta", po::value<double>(), "learning rate")
92  ("kappa", po::value<double>(), "target rate")
93  ("simtime", po::value<double>(), "simulation time")
94  ("active", po::value<bool>(), "toggle learning")
95  ("poisson", po::value<bool>(), "toggle poisson stimulus")
96  ("winh", po::value<double>(), "inhibitory weight multiplier")
97  ("wei", po::value<double>(), "ei weight multiplier")
98  ("chi", po::value<double>(), "chi current multiplier")
99  ("seed", po::value<int>(), "random seed")
100  ;
101 
102  po::variables_map vm;
103  po::store(po::parse_command_line(ac, av, desc), vm);
104  po::notify(vm);
105 
106  if (vm.count("help")) {
107  std::cout << desc << "\n";
108  return 1;
109  }
110 
111  if (vm.count("quiet")) {
112  quiet = true;
113  }
114 
115  if (vm.count("load")) {
116  std::cout << "input weight matrix "
117  << vm["load"].as<string>() << ".\n";
118  infilename = vm["load"].as<string>();
119  }
120 
121  if (vm.count("out")) {
122  std::cout << "output filename "
123  << vm["out"].as<string>() << ".\n";
124  outputfile = vm["out"].as<string>();
125  }
126 
127  if (vm.count("stimfile")) {
128  std::cout << "stimfile filename "
129  << vm["stimfile"].as<string>() << ".\n";
130  stimfile = vm["stimfile"].as<string>();
131  }
132 
133  if (vm.count("eta")) {
134  std::cout << "eta set to "
135  << vm["eta"].as<double>() << ".\n";
136  eta = vm["eta"].as<double>();
137  }
138 
139  if (vm.count("kappa")) {
140  std::cout << "kappa set to "
141  << vm["kappa"].as<double>() << ".\n";
142  kappa = vm["kappa"].as<double>();
143  }
144 
145  if (vm.count("simtime")) {
146  std::cout << "simtime set to "
147  << vm["simtime"].as<double>() << ".\n";
148  simtime = vm["simtime"].as<double>();
149  }
150 
151  if (vm.count("active")) {
152  std::cout << "stdp active : "
153  << vm["active"].as<bool>() << ".\n";
154  stdp_active = vm["active"].as<bool>();
155  }
156 
157  if (vm.count("poisson")) {
158  std::cout << "poisson active : "
159  << vm["poisson"].as<bool>() << ".\n";
160  poisson_stim = vm["poisson"].as<bool>();
161  }
162 
163 
164  if (vm.count("winh")) {
165  std::cout << "inhib weight multiplier : "
166  << vm["winh"].as<double>() << ".\n";
167  winh = vm["winh"].as<double>();
168  }
169 
170  if (vm.count("wei")) {
171  std::cout << "ei weight multiplier : "
172  << vm["wei"].as<double>() << ".\n";
173  wei = vm["wei"].as<double>();
174  }
175 
176  if (vm.count("chi")) {
177  std::cout << "chi multiplier : "
178  << vm["chi"].as<double>() << ".\n";
179  chi = vm["chi"].as<double>();
180  }
181 
182  if (vm.count("seed")) {
183  std::cout << "seed set to "
184  << vm["seed"].as<int>() << ".\n";
185  seed = vm["seed"].as<int>();
186  }
187 
188  }
189  catch(std::exception& e) {
190  std::cerr << "error: " << e.what() << "\n";
191  return 1;
192  }
193  catch(...) {
194  std::cerr << "Exception of unknown type!\n";
195  }
196 
197  // BEGIN Global definitions
198  auryn_init( ac, av );
199  // END Global definitions
200  std::stringstream oss;
201  oss << outputfile << "." << sys->mpi_rank();
202  string basename = oss.str();
203 
204 
205  logger->msg("Setting up neuron groups ...",PROGRESS,true);
206  TIFGroup * neurons_e = new TIFGroup(NE);
207  TIFGroup * neurons_i = new TIFGroup(NI);
208  neurons_e->random_mem(-60e-3,5e-3);
209  neurons_i->random_mem(-60e-3,5e-3);
210  PoissonGroup * poisson = new PoissonGroup(NP,poisson_rate);
211 
212 
213  logger->msg("Setting up connections ...",PROGRESS,true);
214  SparseConnection * con_exte = new SparseConnection(poisson,neurons_e,0,sparseness_afferents,GLUT);
215  con_exte->seed(seed);
216 
217  SparseConnection * con_ei = new SparseConnection(neurons_e,neurons_i,wei*w,sparseness,GLUT);
218 
219  SparseConnection * con_ii = new SparseConnection(neurons_i,neurons_i,gamma*w,sparseness,GABA);
220 
221 
222  SparseConnection * con_ee = new SparseConnection(neurons_e,neurons_e,w,sparseness,GLUT);
223  SymmetricSTDPConnection * con_ie = new SymmetricSTDPConnection(neurons_i,neurons_e,
224  gamma*w,sparseness,
225  gamma*eta,kappa,tau_stdp,wmax,
226  GABA);
227 
228 
229  if (winh>=0)
230  con_ie->set_all(winh);
231 
232  logger->msg("Setting up monitors ...",PROGRESS,true);
233  strbuf = basename;
234  strbuf += ".e.ras";
235  SpikeMonitor * smon_e = new SpikeMonitor( neurons_e , strbuf.c_str() );
236 
237  strbuf = basename;
238  strbuf += ".i.ras";
239  SpikeMonitor * smon_i = new SpikeMonitor( neurons_i, strbuf.c_str() );
240 
241  strbuf = basename;
242  strbuf += ".volt";
243  StateMonitor * vmon = new StateMonitor( neurons_e, record_neuron, "mem", strbuf.c_str() );
244 
245  strbuf = basename;
246  strbuf += ".ampa";
247  StateMonitor * amon = new StateMonitor( neurons_e, record_neuron, "g_ampa", strbuf.c_str() );
248 
249  strbuf = basename;
250  strbuf += ".gaba";
251  StateMonitor * gmon = new StateMonitor( neurons_e, record_neuron, "g_gaba", strbuf.c_str() );
252 
253  RateChecker * chk = new RateChecker( neurons_e , 0.1 , 1000. , 100e-3);
254 
255  for ( int j = 0; j < NE ; j++ ) {
256  neurons_e->set_bg_current(j,bg_current);
257  }
258 
259  for ( int j = 0; j < NI ; j++ ) {
260  neurons_i->set_bg_current(j,bg_current);
261  }
262 
263 
264  // stimulus
265  if (!stimfile.empty()) {
266  char ch;
267  NeuronID counter = 0;
268  std::ifstream fin(stimfile.c_str());
269  while (!fin.eof() && counter<NE) {
270  ch = fin.get();
271  if (ch == '1') {
272  if (poisson_stim==true) {
273  for (int i = 0 ; i < NP ; ++i)
274  con_exte->set(i,counter,w_ext);
275  } else {
276  neurons_e->set_bg_current(counter,chi*bg_current);
277  }
278  }
279  counter++;
280  }
281  fin.close();
282  }
283 
284  if (!infilename.empty()) {
285  sys->load_network_state(infilename);
286  }
287 
288  logger->msg("Simulating ...",PROGRESS,true);
289  con_ie->stdp_active = stdp_active;
290 
291  sys->run(simtime);
292 
293  logger->msg("Saving network state ...",PROGRESS,true);
294  sys->save_network_state(netstatfile);
295 
296  logger->msg("Freeing ...",PROGRESS,true);
297  auryn_free();
298 
299  logger->msg("Exiting ...",PROGRESS,true);
300  return errcode;
301 }
void auryn_free()
Cleanly shuts down Auryn simulation environment.
Definition: auryn_global.cpp:107
Implements a symmetric STDP window with an optional presynaptic offset as used for inhibitory plastic...
Definition: SymmetricSTDPConnection.h:44
Standard Glutamatergic (excitatory) transmission.
Definition: auryn_definitions.h:139
void random_mem(AurynState mean=-60e-3, AurynState sigma=5e-3)
Definition: NeuronGroup.cpp:81
unsigned int mpi_rank()
Returns current rank.
Definition: System.cpp:1009
void load_network_state(std::string basename)
Loads network state from a netstate file.
Definition: System.cpp:812
void seed(NeuronID randomseed)
This function seeds the pseudo random number generator for all random fill operatios.
Definition: SparseConnection.cpp:155
A Checker class that tracks population firing rate as a moving average and breaks a run if it goes ou...
Definition: RateChecker.h:59
The base class to create sparse random connections.
Definition: SparseConnection.h:66
#define NI
Number of inhibitory neurons.
Definition: sim_isp_orig.cpp:40
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
The standard Monitor object to record spikes from a SpikingGroup and write them to a text file...
Definition: SpikeMonitor.h:52
virtual void set_all(AurynWeight weight)
Sets all weights of existing connections to the given value.
Definition: SparseConnection.cpp:335
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
A SpikingGroup that creates poissonian spikes with a given rate.
Definition: PoissonGroup.h:52
Conductance based LIF neuron model with absolute refractoriness as used in Vogels and Abbott 2005...
Definition: TIFGroup.h:38
#define NP
Number of Poisson input neurons.
Definition: sim_isp_orig.cpp:41
void auryn_init(int ac, char *av[], string dir, string simulation_name, string logfile_prefix, LogMessageType filelog_level, LogMessageType consolelog_level)
Initalizes MPI and the Auryn simulation environment.
Definition: auryn_global.cpp:84
void set_bg_current(NeuronID i, AurynFloat current)
Controls the constant current input (per default set so zero) to neuron i.
Definition: TIFGroup.cpp:121
bool stdp_active
Definition: SymmetricSTDPConnection.h:61
Standard Gabaergic (inhibitory) transmission.
Definition: auryn_definitions.h:140
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
Definition: Logger.h:41
virtual void set(NeuronID i, NeuronID j, AurynWeight value)
Sets a single connection to value if it exists.
Definition: SparseConnection.cpp:684
void save_network_state(std::string basename)
Saves network state to a netstate file.
Definition: System.cpp:694
Records from an arbitray state vector of one unit from the source SpikingGroup to a file...
Definition: StateMonitor.h:40
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
#define NE
Number of excitatory neurons.
Definition: sim_isp_orig.cpp:39
Here is the call graph for this function: