individual.h
来自「多目标优化进化算法目前公认效果收敛性最好的算法NSGA2c++源码,具有一般性」· C头文件 代码 · 共 70 行
H
70 行
///////////////////////////////////////////////////////////////////
/*****************************************************************
Copyright: Artificial Life and Adaptive Robotics Laboratory - ALAR
School of ITEE, UNSW@ADFA, Australia, 2005
*******************************************************************/
///////////////////////////////////////////////////////////////////#if !defined(_INDIVIDUAL)#define _INDIVIDUAL#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000#include <math.h>#include <fstream.h>#include <iostream.h>#include <iomanip.h>class individual {public: void setNULL(); double decode_gene(int index); individual &operator=(const individual &id); void set_chromosome(unsigned int *ch); void print_fn(ofstream &f); void print_x(ofstream &f); void Initialize(int n_Genes,int n_Objs,int *GSize,double *Ub,double *Lb,double *real_params,int withbinary); void set_Dfitness(double *); unsigned long b2d(unsigned int * digits,unsigned int lbits); unsigned int* d2b(unsigned long number, unsigned int &lbits); unsigned int *value2string(double value,int gene_index,int &lsize); // convert a real value to a binary string individual(); individual(int n_Genes,int n_Objs,int *GSize,double *Ub,double *Lb,double *real_params,int withbinary); virtual ~individual(); double *Dgenes; // chromosome for real-parameters: genotype unsigned int *Bgenes; // chromosome for binary representation: genotype int *Isize; // proportion of each gene in the chromosome
int *Psize; // proportion of each gene in the chromosome
int InumberofGenes; // number of genes in the chromosome int chromosome_len; double *DfitnessC; // without noise double *DfitnessN;// with noise int InumberofObjs; // number of objectives double DglobalFitness; // sharing fitness int rank; double *Dupper; // upper bound for each gene double *Dlower;// lower bound for each gene};#endif // !defined(AFX_INDIVIDUAL_H__58DF7132_74D3_4ED6_9BB5_3E4B7EC554A9__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?