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

📄 synapseproperties.cpp

📁 amygdata的神经网络算法源代码
💻 CPP
字号:
/***************************************************************************                          synapseproperties.cpp  -  description                             -------------------    copyright            : (C) 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 "synapseproperties.h"#include "logging.h"#include "utilities.h"using namespace Amygdala;using namespace Utilities;SynapseProperties::SynapseProperties(AmTimeInt _delay):    Properties(),    delay(_delay){}SynapseProperties::~SynapseProperties(){}StaticSynapseProperties::StaticSynapseProperties(float _weight, AmTimeInt _delay):    SynapseProperties(_delay),    weight(_weight){}StaticSynapseProperties::~StaticSynapseProperties(){}void StaticSynapseProperties::SetProperty(const std::string& name, const std::string& value){    if(name == "delay") delay = atoi (value.c_str());    else if (name == "weight") weight = atof(value.c_str());}std::map< std::string, std::string > StaticSynapseProperties::GetPropertyMap() const{    std::map< std::string, std::string > props;    props["weight"] = ftostr(weight);    props["delay"] = ftostr(delay);    return props;}DynamicSynapseProperties::DynamicSynapseProperties(AmTimeInt _delay):    SynapseProperties(_delay){    U = D = A = F = 0.;}DynamicSynapseProperties::~DynamicSynapseProperties(){}void DynamicSynapseProperties::SetDynaParam(const char param, float value){    switch (param) {        case 'U':            U = value;            break;        case 'D':            D = value;            break;        case 'A':            A = value;            break;        case 'F':            F = value;            break;    }}const float & DynamicSynapseProperties::GetDynaParam(const char param){    switch (param) {        case 'U':            return U;        case 'D':            return D;        case 'A':            return A;        case 'F':            return F;    }}void DynamicSynapseProperties::SetProperty(const std::string& name, const std::string& value){    if(name == "delay") delay = atoi (value.c_str());    else if (name == "A") A = atof(value.c_str());    else if (name == "U") U = atof(value.c_str());    else if (name == "D") D = atof(value.c_str());    else if (name == "F") F = atof(value.c_str());}std::map< std::string, std::string > DynamicSynapseProperties::GetPropertyMap() const{    std::map< std::string, std::string > props;    props["delay"]  = ftostr(delay);    props["A"]      = ftostr(A);    props["U"]      = ftostr(U);    props["D"]      = ftostr(D);    props["F"]      = ftostr(F);    return props;}

⌨️ 快捷键说明

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