population.h

来自「linux下的一个分组遗传算法」· C头文件 代码 · 共 63 行

H
63
字号
//// population.h - Used for the Genetic Grouping Algorithm//// author: J.I.v.Hemert// last updated : 07-11-1997//// This file contains the class PopulationC.//#ifndef POPULATION_H#define POPULATION_H#include <MLCG.h>#include <fstream.h>#include "genotype.h"#define MAXPOPSIZE 500typedef struct GaParamsT{	int PopulationSize;	int N_Crossover;	int N_Mutation;	int N_Inversion;	double AllelMutationProb;};class PopulationC{	public:		void Initialize (GaParamsT gaparameters, int nrofobjects, bool debugactive, int k_coloring, ColoringT coloringalgorithm);		void Evaluate ();		void Reproduce ();		void PrintBest (ofstream & output);		void PrintBest ();		void PrintPop ();		double GetBestFitness ();		double GetColorsUsed ();		double GetTotalEvaluations ();	private:		GenotypeC population[MAXPOPSIZE];		GaParamsT gaparams;		bool debug;		double totalfitness;		int bestindex;		double totalevaluations;		void PlayTwoTournament ();		void ApplyCrossover ();		void ApplyMutation ();		void ApplyInversion ();};#endif// eof population.h

⌨️ 快捷键说明

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