gascaling.h

来自「遗传算法做的排课系统」· C头文件 代码 · 共 53 行

H
53
字号

#ifndef __GA_SCALING_H__
#define __GA_SCALING_H__

#include "..\CallConvention.h"
#include "..\Common\GaParameters.h"
#include "..\Common\GaOperation.h"
#include "..\Common\GaCatalogue.h"
#include "..\Chromosome\GaChromosome.h"

using namespace Common;
using namespace Chromosome;
using namespace Population; 

namespace Population
{

	class GaPopulation;

	// Base class for scaling parameters
	class GaScalingParams : public GaParameters { };
	// END CLASS DEFINITION GaScalingParams

	// Interface for scaling operation
	class GaScalingOperation : public GaOperation
	{

	public:

		// Scales chromosome fitness value based on passed parameters
		virtual float GACALL operator ()(const GaScaledChromosome& chromosome,
							const GaPopulation& population,
							const GaScalingParams& parameters) const=0;

		// Returns TRUE if the scaling operation is based on ranking of the chromosome in the population
		virtual bool GACALL IsRankingBased() const=0;

		// Returns TRUE if rescaling is needed for all chromosomes in population
		virtual bool GACALL NeedRescaling(const GaPopulation& population,
							 const GaScalingParams& parameters) const=0;

	};// END CLASS DEFINITION GaScalingOperation

	// Scaling operation and its parameters
	typedef GaOperationParametersPair<GaScalingOperation, GaScalingParams> GaScalingPair;

	// Catalogue of scaling operations
	typedef GaCatalogue<GaScalingOperation> GaScalingCatalogue;

} // Population

#endif // __GA_SCALING_H__

⌨️ 快捷键说明

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