重新复盘了一下种群的特性,除了内在参数外,种群也对应的兴奋性种群和抑制性种群,兴奋种群的神经元释放的脉冲能够增加后神经元的膜电位,而抑制性神经元则相反。那用程序语言描述就是
enum Population_type
{EXC,INH
};struct SynapseParams
{double weight;double delay;Population_type type;SynapseParams() :weight(0.0), delay(0.0), type(EXC) {};
};
我重新设计了突触类的内容,.h文件和,cpp文件如下:
#ifndef POPULATION_H
#define POPULATION_H#include <vector>
#include "Params.h"class Population
{
public:Population(SynapseParams &sparams_);~Population();/// <summary>/// 设置种群的数量/// </summary>/// <param name="nums_">输入种群的数量</param>void set_num_neurons(int nums_);/// <summary>/// 添加神经元对应的gid/// </summary>/// <param name="idx">添加的位置</param>/// <param name="gid_">神经元对应的gid</param>void add_neuron_gid(int idx,int gid_);/// <summary>/// 返回种群的id/// </summary>/// <returns>种群的id</returns>const int get_group_id();/// <summary>/// 获取种群的神经元的数量/// </summary>/// <returns>神经元的数量</returns>const int get_num_neurons();/// <summary>/// 获取种群中的gid的集合/// </summary>/// <returns>种群中的gid的集合</returns>const std::vector<int>& get_group_gids();private:int num_neurons; //种群的神经元数量std::vector<int> neuron_gids;static int nextId; // 静态成员变量,用于存储下一个种群的ID标识,在每次生成对象后自增1int group_id; // 种群的ID标识SynapseParams sparams;
};int Population::nextId = 0;inline const int Population::get_group_id()
{return group_id;
}inline const int Population::get_num_neurons()
{return num_neurons;
}inline const std::vector<int>& Population::get_group_gids()
{return neuron_gids;
}inline void Population::set_num_neurons(int nums_)
{num_neurons = nums_;neuron_gids.resize(num_neurons);
}inline void Population::add_neuron_gid(int idx, int gid_)
{neuron_gids[idx] = gid_;
}#endif // !POPULATION_H
#include "Population.h"Population::Population(SynapseParams& sparams_):group_id(0),num_neurons(0),neuron_gids()
{group_id = nextId++;sparams = sparams_;
}Population::~Population()
{
}
接下来就是代码的全部重新整理了,呜呜呜~,加油