00001 /*************************************************************************** 00002 * SpikeStream STDP1 Synapse * 00003 * Copyright (C) 2007 by David Gamez * 00004 * david@davidgamez.eu * 00005 * Version 0.1 * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 ***************************************************************************/ 00022 00023 #ifndef STDP1SYNAPSE_H 00024 #define STDP1SYNAPSE_H 00025 00026 //SpikeStream includes 00027 #include "Debug.h" 00028 #include "SimulationClock.h" 00029 #include "Synapse.h" 00030 00031 //Other includes 00032 #include <cmath> 00033 #include <iostream> 00034 using namespace std; 00035 00036 00037 //----------------------------- STDP1 Synapse ------------------------------ 00038 /*! Synapse based on J.M. Brader, W. Senn and S. Fusi (2006). Learning real 00039 world stimuli in a neural network with spike driven synaptic dynamics. 00040 Submitted to Neural Computation (2006). 00041 Available at: http://www.ini.unizh.ch/~fusi/papers/bsf05.pdf. */ 00042 //-------------------------------------------------------------------------- 00043 00044 class STDP1Synapse : public Synapse { 00045 00046 public: 00047 STDP1Synapse(); 00048 ~STDP1Synapse(); 00049 00050 //Public methods inherited from synapse 00051 void calculateFinalState(); 00052 const string* getDescription(); 00053 string getMonitoringInfo(); 00054 MonitorData* getMonitoringData(); 00055 inline short getShortWeight(); 00056 inline double getWeight(); 00057 bool parametersChanged(); 00058 inline void processSpike(); 00059 00060 //Public methods unique to this class 00061 void updateWeight(double membranePotential, double calciumConc); 00062 bool testFunction(); 00063 00064 00065 private: 00066 //=============================== VARIABLES =================================== 00067 /* Parameters are held in the synapse map and accessed using these static 00068 string keys. */ 00069 00070 /*! Threshold of calcium concentration controlling weight change during learning.*/ 00071 static const string calciumThreshUpLow; 00072 00073 /*! Threshold of calcium concentration controlling weight change during learning.*/ 00074 static const string calciumThreshUpHigh; 00075 00076 /*! Threshold of calcium concentration controlling weight change during learning.*/ 00077 static const string calciumThreshDownLow; 00078 00079 /*! Threshold of calcium concentration controlling weight change during learning.*/ 00080 static const string calciumThreshDownHigh; 00081 00082 /*! Weight change is voltage dependent and only takes place once the post synaptic 00083 neuron's membrane potential is over a given threshold.*/ 00084 static const string weightChangeThreshold; 00085 00086 /*! Weight increase takes place in small jumps.*/ 00087 static const string weightIncreaseAmnt; 00088 00089 /*! Weight increase takes place in small jumps.*/ 00090 static const string weightDecreaseAmnt; 00091 00092 /*! In the absence of stimulation or weight change, the weight drifts towards the 00093 maximumDrift if it is above this threshold and towards the minimumDrift if it 00094 is below this threshold.*/ 00095 static const string driftThreshold; 00096 00097 /*! The positive drift amount.*/ 00098 static const string positiveDrift; 00099 00100 /*! The negative drift amount.*/ 00101 static const string negativeDrift; 00102 00103 /*! The maximum value that the weight can drift to. This can be used to prevent an 00104 inhibitory connection drifting into an excitatory connection when it would be 00105 better for it to drift towards zero.*/ 00106 static const string maximumDrift; 00107 00108 /*! The minimum value that the weight can drift to. This can be used to prevent an 00109 excitatory connection drifting into an inhibitory connection when it would be 00110 better for it to drift towards zero.*/ 00111 static const string minimumDrift; 00112 00113 /*! Whether synapse is in learning mode or not.*/ 00114 static const string learning; 00115 00116 /*! Enables the synapse to be disabled so that it does not transmit spikes.*/ 00117 static const string disable; 00118 00119 /*! Records the timestep in which the last spike was received. This is so that 00120 the learning method only applies to synapses that have received a spike in 00121 the last time step.*/ 00122 int spikeTimeStep; 00123 00124 /*! The current time.*/ 00125 double currentTime; 00126 00127 /*! The time since the synapse was last updated.*/ 00128 double lastUpdateTime; 00129 00130 /*! Need the previous learning mode to determine whether this has been switched on or off. 00131 Cannot make this static because there could be different learning modes present in the 00132 same neuron group.*/ 00133 bool oldLearningMode; 00134 00135 00136 //=============================== METHODS =================================== 00137 void calculateWeight(bool spikeReceived); 00138 bool checkParameters(); 00139 void normaliseWeight(); 00140 void printParameters(); 00141 00142 }; 00143 00144 00145 #endif//STDP1SYNAPSE_H 00146 00147
1.4.4