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

📄 gareplacement.h

📁 遗传算法做的排课系统
💻 H
字号:

#ifndef __GA_REPLACEMENT_H__
#define __GA_REPLACEMENT_H__

#include "..\CallConvention.h"
#include "..\Common\GaParameters.h"
#include "..\Common\GaOperation.h"
#include "..\Common\GaCatalogue.h"
#include "GaCoupling.h"

using namespace Common;
using namespace Population; 

namespace Population
{
	class GaPopulation;

	// Base class of all parameters for replacement operations.
	class GaReplacementParams : public GaParameters
	{

	protected:

		// Number of chromosomes which will be replaced
		int _replacemetSize;

	public:

		// Initialization of the parameters
		DLL_EXPORT
		GaReplacementParams(int replacementSize);

		// Initialization of the parameters with default values
		DLL_EXPORT
		GaReplacementParams();

		// Virtual copy constructor
		DLL_EXPORT
		virtual GaParameters* GACALL Clone() const;

		// Returns the number of chromosomes which will be replaced
		DLL_EXPORT
		int GACALL GetReplacementSize() const;

		// Sets the number of chromosomes which will be replaced
		DLL_EXPORT
		void GACALL SetReplacementSize(int size);

	};// END CLASS DEFINITION GaReplacementParams

	// Interface for replacement operations.
	class GaReplacementOperation : public GaOperation
	{

	public:

		// Replaces existing chromosomes with new ones based on passed parameters and selection results.
		virtual void GACALL operator ()(GaPopulation& population,
						   const GaReplacementParams& parameters,
						   const GaCouplingResultSet& newChromosomes) const=0;

	};// END CLASS DEFINITION GaReplacementOperation

	// Replacement operation and its parameters
	typedef GaOperationParametersPair<GaReplacementOperation, GaReplacementParams> GaReplacementPair;

	// Catalogue of replacement operations
	typedef GaCatalogue<GaReplacementOperation> GaReplacementCatalogue;

} // Population

#endif // __GA_REPLACEMENT_H__

⌨️ 快捷键说明

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