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

📄 value.cc

📁 遗传算法和神经网络结合
💻 CC
字号:
/*  YAKS, a Khepera simulator including a separate GA and ANN   (Genetic Algoritm, Artificial Neural Net).  Copyright (C) 2000  Johan Carlsson (johanc@ida.his.se)    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 any later version.    This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License for more details.    You should have received a copy of the GNU General Public License  along with this program; if not, write to the Free Software  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*/#include "value.h"Value::Value(const char *iTitle, const double *iValue){  description = NULL;  i_value = NULL;  if(iTitle!=NULL)    description = strdup(iTitle);  d_value = iValue;}Value::Value(const char *iTitle, const int8_t *iValue){  description = NULL;  d_value = NULL;  if(iTitle!=NULL)    description = strdup(iTitle);  i_value = iValue;}Value::~Value(){  if(description!=NULL)    free(description);}double Value::getVal(){  //  printf("Value is %f \n",*value);  double val;  if(d_value){    if(*d_value < 1.0)      return *d_value;    else      return 0.0;  }  else{    val = (double) *i_value;    val +=(double) 127;      val = val / (double)(127 * 2.0);    if(val <= 1.0)      return val;    else      return 0.0;  }}char *Value::getDescription(){  return description;}void Value::redefine(const double *iValue){  d_value = iValue;}void Value::redefine(const int8_t *iValue){  i_value = iValue;}

⌨️ 快捷键说明

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