⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spikingneuron.cpp

📁 amygdata的神经网络算法源代码
💻 CPP
字号:
/***************************************************************************                          spikingneuron.cpp  -  description                             -------------------    copyright            : (C) 2001, 2002, 2003, 2004 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.                                   * *                                                                         * ***************************************************************************/#include "spikingneuron.h"#include "spikingneuronproperties.h"#include "axon.h"#include "outputmanager.h"#include "dendrite.h"#include "logging.h"#include <string>using namespace Amygdala;// TODO: Initialize the rest of the variables SpikingNeuron::SpikingNeuron(AmIdInt neuronId, const SpikingNeuronProperties& props):    Neuron(neuronId, props),    schedSpikeTime(0),    currTime(0),    inputTime(0),    membranePtnl(0){	refPeriod = props.GetRefractoryPeriod();    dendrite = new Dendrite(this);}SpikingNeuron::~SpikingNeuron(){}void SpikingNeuron::SetTrainer(Trainer* t){    dendrite->SetTrainer(t);}void SpikingNeuron::SendSpike(AmTimeInt& now){    if (schedSpikeTime == now) {        LOGGER(5, "Neuron " << nId << " spiking!")        // Do a check to make sure the refractory period has passed.  This        // check will normally be done before the spike is scheduled, but        // some spikes can get thru anyway (input spikes, for example).        // Any spikes scheduled within the refractory period are ignored.        if ( (now - spikeTime) <= refPeriod ) {            // Don't do anything if spikeTime == 0 because this neuron            // has not yet fired and the simulation time could be less            // than the refractory period.            if (spikeTime) {                return;            }        }        membranePtnl = 0;        currTime = now;        LOGGER(6, "Calling Network::ScheduleSpikeDelay() -- size " << axon->size() << " -- Neuron " << nId);        // Everything will now go through the ScheduleSpikeDelay()        // function to make the interface easier to understand.        // The previous default mode is only useful on small networks        // and the benefits would probably not be noticed.        // MG 9/29/2002        // TODO: Does something need to change here?  How should this be done with        // the new axon design.        Network::GetNetworkRef()->ScheduleSpikeDelay(axon);        spikeTime = schedSpikeTime;        schedSpikeTime = 0;        SpikeCleanup();        dendrite->ReportSpike();        if (outputGroupIdx & outputMode) {	        OutputManager::SendOutput(this, now);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -