population.h
来自「基本遗传算法在求一个函数表达式的最大值应用!」· C头文件 代码 · 共 38 行
H
38 行
#ifndef POPULATION
#define POPULATION
//mycodes
#include "chromosome.h"
#include "parameter.h"
extern MyParameter myparameter;
class Population {
private:
int PopSize; // population size
// information for statistical purposes
int Best; // index of best individual
double MaxFit; // maximum fitness
double MinFit; // minimum fitness
double AvgFit; // average fitness
protected:
//
public:
Chromosome *chromosomes; // individuals
int *MatingPool; // mating pool
Population(int popsize = myparameter.popsize );
Population(Population & pop);
~Population();
int get_popsize(){ return PopSize; }
int get_best() { return Best; }
double get_maxfit(){ return MaxFit; }
double get_minfit(){ return MinFit; }
double get_avgfit(){ return AvgFit; }
void evaluate();
void selection();
void tournamentSeclection();
};
#endif///:~POPULATION
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?