📄 gascaling.h
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -