123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #include <iostream>
- #include <math.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <libcsim.hpp>
- ////////////////////
- const int Ne = 1600; // excitatory neurons
- const int Ni = Ne/4; // inhibitory neurons
- const int N = Ne+Ni; // total number of neurons
- const int M = N/10; // the number of synapses per neuron
- const int D = 20; // maximal axonal conduction delay
- float sm = 10.0; // maximal synaptic strength
- const int PS = 10; // max pattern size
- const int PO = 9; // pattern overlap
- const int NP = 100; // number of patterns
- const int PTIME = 20; // time per pattern in ms
- const float ISTRENGTH = 20; // input strength
- const float TAULEARN = 150; //
- int ipat[NP][PS]; // input pattern array
- int ppt; // pattern pointer
- int ptime; // pattern time
- int testtime; // time to next test stimulus
- int simphase; // simulation phase; 0: training; 1: test
- int main()
- {
- InitLibCSim();
- int i, j, k, sec, t;
- liflayer *exlayer;
- exlayer=new liflayer(800);
- exlayer->SetSpikeFileName("exspikes.dat");
- input *inp = new input(exlayer, 5);
- layer *inhlayer= new layer(200);
- connection *ccc = new connection(exlayer,exlayer);
- ccc->ConnectDirectional(0.035, 6);
- ccc->SetFileName("exexweights.dat");
- ccc->Save();
- ccc->SetLearn(false);
- connection *cei = new connection(exlayer,inhlayer);
- cei->ConnectRandom(0.025,0.1);
- cei->SetFileName("exinhweights.dat");
- cei->SetLearn(false);
- connection *cie = new connection(inhlayer,exlayer);
- cie->ConnectRandom(0.5,-2);
- cie->SetLearn(false);
- for (sec=0; sec<60*60*24; sec++) // simulation of 1 day
- {
- cout << "sec= " << sec << " ";
- // if ((sec%10)<9) simphase=0; else simphase=1;
- for (t=0;t<1000;t++) // simulation of 1 sec
- {
- exlayer->proceede(t);
- inhlayer->proceede(t);
- ccc->proceede(t);
- cei->proceede(t);
- cie->proceede(t);
- if (t>200 && t<400) inp->proceede();
- }
- exlayer->prepare();
- inhlayer->prepare();
- ccc->prepare();
- cei->prepare();
- cie->prepare();
- }
- }
|