gareplacement.h
来自「遗传算法做的排课系统」· C头文件 代码 · 共 73 行
H
73 行
#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 + =
减小字号Ctrl + -
显示快捷键?