📄 synapse.h
字号:
/*************************************************************************** synapse.h - description ------------------- begin : Fri Jun 20 2003 copyright : (C) 2003 by Matt Grover email : mgrover@amygdala.org ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#ifndef SYNAPSE_H#define SYNAPSE_H#include <vector>#include <string>#include <amygdala/dendrite.h>#include <amygdala/synapseproperties.h>#include <amygdala/nconnector.h>#include <amygdala/logging.h>#include <amygdala/amygdalaclass.h>namespace Amygdala {class Neuron;class SpikingNeuron;class Dendrite;struct SynapseStruct { Neuron* postNeuron; float weight; AmTimeInt delay;};/** @class Synapse synapse.h amygdala/synapse.h * @brief Container for synaptic properties * * Synapse facilitates the connection between two neurons. * It maintains data relevant to a particular connection, such * as weight values. Users do not create or interact with * Synapses directly, but the Synapse type must be specified * when a NeuronConnector is created. * @see NeuronConnector * @author Matt Grover */class Synapse: public AmygdalaClass {public: virtual ~Synapse() {}; /** Make a copy of this Synapse into the * memory pointed to by newSynapse */ virtual void Clone(void* newSynapse)=0; /** @returns The dendrite attached to the postsynaptic neuron */ Dendrite* GetDendrite() const { return dendrite; } /** Transmit a spike to the dendrite. */ virtual void TransmitSpike(const AmTimeInt& time) = 0; /** @return The SynapseProperties that were used to initialize * the Synapse */ virtual SynapseProperties* Properties() const = 0; /** @return A value that can be used to identify the type of Trainer * that can be used with this synapse. A value of 'N/A' indicates that * the synapse is not trainable. Some synapses may not be trainable for * reasons of efficiency and may have trainable versions available when that * functionality is needed. */ virtual const std::string TrainableType() const { return "N/A"; }protected: /** Build a Synapse from properties */ Synapse(SynapseProperties& synProps); /** Copy constructor */ Synapse(const Synapse& rhs); /** @return Id of the post-synaptic neuron */ AmIdInt GetPostNrnId(); /** Set property values according to the values in props. * @return A ptr to this synpase's Properties object (copied * from props) */ SynapseProperties* Properties(SynapseProperties* props) const; Dendrite* dendrite; /** Connection object to attach synapses to a neuron */ AmTimeInt lastTransTime; // time of the last spike that passed through synapse template<class synapse, class synapseProperty> friend class NeuronConnector;};/** @class StaticSynapse synapse.h amygdala/synapse.h * @brief A Synapse class that models a static synapse. * * StaticSynapses are modeled as classical fixed-weight * connections between neurons. The weight values may * be modified during a training cycle, but they will * not be changed otherwise. * @see Synapse, DynamicSynapse * @author Matt Grover */class StaticSynapse: public Synapse { template<class synapse, class synapseProperty> friend class NeuronConnector;public: typedef StaticSynapseProperties PropertyType; typedef NeuronConnector<StaticSynapse, PropertyType> NeuronConnector; static NeuronConnector Connect; virtual ~StaticSynapse() {}; /** Make a copy of this Synapse into the * memory pointed to by newSynapse (uses placement new) */ virtual void Clone(void* newSynapse); virtual SynapseProperties* Properties() const; /** @returns Value of the synaptic weight . */ float& GetWeight() { return weight; } /** Set the synaptic weight. */ void SetWeight(float _weight) { weight = _weight; } /** Transmit a spike to the dendrite. TransmitSpike() performs * a simple addition of the synapse's weight to the aggregated * weight in the dendrite. This is a static synapse model by default.*/ virtual void TransmitSpike(const AmTimeInt& time); virtual const std::string TrainableType() const { return "Static"; }protected: StaticSynapse(StaticSynapseProperties& synProps); StaticSynapse(const StaticSynapse& rhs); float weight; unsigned int trainingHistIdx;};/** @class DynamicSynapse synapse.h amygdala/synapse.h * @brief A Synapse class that models a dynamic synapse. * * DynamicSynapse is a synapse model in which the connection * strength (weight) can vary in response to the spiking behavior * of the pre-synaptic neuron. The overall connection strength * can also be modified during training cycles. This synapse model * only models depressing behavior which appears to be the dominant * mode for pyramid neurons * @see Synapse, StaticSynapse * @author Matt Grover * @author Rudiger Koch */class DynamicSynapse: public Synapse { template<class synapse, class synapseProperty> friend class NeuronConnector;public: typedef DynamicSynapseProperties PropertyType; typedef NeuronConnector<DynamicSynapse, PropertyType> NeuronConnector; static NeuronConnector Connect; virtual ~DynamicSynapse() {}; virtual void Clone(void* newSynapse); virtual SynapseProperties* Properties() const; virtual void TransmitSpike(const AmTimeInt& time);protected: DynamicSynapse(DynamicSynapseProperties& synProps); DynamicSynapse(const DynamicSynapse& rhs); /** Dynamic Synapse Properties as in Markram et. al.: * "Differential signaling via the same axon of neocortical pyramid neurons" */ float invD, invF, A, U, D, F; /** How much is currently left of the max available efficacy */ float fraction; /** running value of utilization */ float u;};} // namespace Amygdala#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -