📄 gafitnesscomparators.h
字号:
#ifndef __GA_FITNESS_COMPARATORS_H__
#define __GA_FITNESS_COMPARATORS_H__
#include "..\CallConvention.h"
#include "GaChromosomeOperations.h"
using namespace Chromosome;
namespace Chromosome
{
namespace FitnessComparators
{
// Used if the fitness value should be minimized
class GaMinFitnessComparator : public GaFitnessComparator
{
public:
// Compares two fitness values and returns:
// a, -1 if the first fitness value lower then the second
// b. 0 if the fitness values are equal
// c. 1 if the first fitness value is greater then the second
virtual int GACALL operator ()(float fitness1,
float fitness2) const;
};// END CLASS DEFINITION GaMinFitnessComparator
// Used if the fitness value should be maximized
class GaMaxFitnessComparator : public GaFitnessComparator
{
public:
// Compares two fitness values and returns:
// a, -1 if the first fitness value lower then the second
// b. 0 if the fitness values are equal
// c. 1 if the first fitness value is greater then the second
virtual int GACALL operator ()(float fitness1,
float fitness2) const;
};// END CLASS DEFINITION GaMaxFitnessComparator
} // FitnessComparators
} // Chromosome
#endif // __GA_FITNESS_COMPARATORS_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -