00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef LAYER_H
00019 #define LAYER_H
00020
00021
00022 using namespace std;
00023 #include <vector>
00024 #include <string>
00025 #include <amygdala/neuron.h>
00026 #include <amygdala/network.h>
00027 #include <amygdala/types.h>
00028
00029 class Network;
00030 class Neuron;
00031
00032
00033
00044 class Layer {
00045 public:
00046 Layer();
00047 ~Layer();
00048
00049 friend class Network;
00050
00058 void AddNeuron(Neuron* nrn);
00059
00067 void AddNeuronVector(vector<Neuron*> nrnVec);
00068
00073 void LayerName(string name) { layerName = name; }
00074
00077 string LayerName() { return layerName; }
00078
00081 void SetLayerId(unsigned int id) { layerId = id; }
00082
00085 unsigned int LayerId() { return layerId; }
00086
00089 void SetLayerType(LayerType ltype) { layerType = ltype; }
00090
00093 LayerType GetLayerType() { return layerType; }
00094
00101 void SetPercentInhibitory( float percent );
00102
00115 bool ConnectLayers(Layer* output, UniConnectType parms, float pctInhibitory = 0.0);
00116
00129 bool ConnectLayers(Layer* output, GaussConnectType parms, float pctInhibitory = 0.0);
00130
00137 bool SetLayerConstants(LayerConstants lconst);
00138
00143 LayerConstants GetLayerConstants();
00144
00147 void SetSynapticDelay(AmTimeInt delay) { synapticDelay = delay; }
00148
00151 AmTimeInt GetSynapticDelay() const { return synapticDelay; }
00152
00153
00154
00155
00156
00158 unsigned int size() { return nrnLayer.size(); }
00159
00160 typedef vector<Neuron*>::iterator iterator;
00161 typedef vector<Neuron*>::const_iterator const_iterator;
00162 typedef vector<Neuron*>::reverse_iterator reverse_iterator;
00163 typedef vector<Neuron*>::const_reverse_iterator const_reverse_iterator;
00164
00166 iterator begin() { return nrnLayer.begin(); }
00168 iterator end() { return nrnLayer.end(); }
00170 const_iterator begin() const { return nrnLayer.begin(); }
00172 const_iterator end() const { return nrnLayer.end(); }
00174 reverse_iterator rbegin() { return nrnLayer.rbegin(); }
00176 reverse_iterator rend() { return nrnLayer.rend(); }
00178 const_reverse_iterator rbegin() const { return nrnLayer.rbegin(); }
00180 const_reverse_iterator rend() const { return nrnLayer.rend(); }
00181
00184 Neuron* operator[](unsigned int& index) { return nrnLayer[index]; }
00185
00186 protected:
00187 void SetLayerParent(Network* parent);
00188 inline bool ConnectionInhibitory(float& pctInhibitory);
00189
00190 vector<Neuron*> nrnLayer;
00191 Network* parentNet;
00192 string layerName;
00193 LayerType layerType;
00194 unsigned int layerId;
00195
00196
00197 float learningConst;
00198 float memTimeConst;
00199 float synTimeConst;
00200 float restPtnl;
00201 float thresholdPtnl;
00202
00203 bool constantsSet;
00204 float percentInhib;
00205 AmTimeInt synapticDelay;
00206
00207 };
00208
00209 #endif
00210