00001 #ifndef GENERICFROEMKEDANSTDPSYNAPSE_H_
00002 #define GENERICFROEMKEDANSTDPSYNAPSE_H_
00003
00004 #include "GenericEachPairStdpSynapse.h"
00005 #include "GenericOnePairStdpSynapse.h"
00006 #include "GenericStaticSpikingSynapse.h"
00007 #include "GenericDynamicSpikingSynapse.h"
00008 #include "GenericCurrentBasedSpikingSynapse.h"
00009 #include "ExponentialDecaySpikeResponse.h"
00010
00011 #include <cmath>
00012
00013 #include <boost/format.hpp>
00014 using boost::format;
00015
00016
00018
00037 template<class BaseSyn>
00038 class GenericFroemkeDanStdpSynapse: public BaseSyn
00039 {
00040 public:
00042 bool useFroemkeDanSTDP;
00043
00045 float tauspost;
00046
00048 float tauspre;
00049
00051 float taupos;
00052
00054 float tauneg;
00055
00057 float STDPgap;
00058
00060 float Wex;
00061
00063 float Aneg;
00064
00066 float Apos;
00067
00069 float mupos;
00070
00072 float muneg;
00073
00074 virtual double stdpLearning(const double & delta, const double & t_post, const double & t_pre, const double & t_prev_post, const double & t_prev_pre );
00075
00076 virtual double maxRelevantSpikeTimeDiff()
00077 {
00078 return 6*(fabs(tauneg)+fabs(taupos));
00079 }
00080
00081 };
00082
00083 #ifdef _MSC_VER
00084 # pragma warning(disable:4244) // warning C4244: '+=' : conversion from 'double' to 'float', possible loss of data
00085 #endif
00086
00087 template<class BaseSyn>
00088 double GenericFroemkeDanStdpSynapse<BaseSyn>::stdpLearning(const double & delta, const double & t_post, const double & t_pre, const double & t_prev_post, const double & t_prev_pre )
00089 {
00090 double dw = 0;
00091
00092 if (delta < -STDPgap) {
00093
00094
00095 dw = pow(BaseSyn::W, muneg) * Aneg * exp(delta/tauneg);
00096 } else if (delta > STDPgap) {
00097
00098
00099 dw = pow(fabs(Wex-BaseSyn::W), mupos) * Apos * exp(-delta/taupos);
00100 } else {
00101 return 0.0;
00102 }
00103
00104 double epost = 1.0;
00105 double epre = 1.0;
00106 if ( useFroemkeDanSTDP ) {
00107 if( t_prev_post > -1 ) epost = 1.0 - exp( -(t_post-t_prev_post) / tauspost );
00108 if( t_prev_pre > -1 ) epre = 1.0 - exp( -(t_pre-t_prev_pre) / tauspre );
00109 BaseSyn::W += epost * epre * dw;
00110
00111 } else {
00112 BaseSyn::W += dw;
00113
00114 }
00115
00116
00117 if ((Wex < 0 && BaseSyn::W >0) || (Wex >0 && BaseSyn::W<0)) BaseSyn::W = 0;
00118
00119
00120 if (fabs(BaseSyn::W) > fabs(Wex)) BaseSyn::W = Wex;
00121
00122 return dw * epost * epre;
00123 }
00124
00125 #ifdef _MSC_VER
00126 # pragma warning(default:4244)
00127 #endif
00128
00129 #endif