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

📄 population.h

📁 基本遗传算法在求一个函数表达式的最大值应用!
💻 H
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -