?? gavaluesets.h
字號:
#ifndef __GA_VALUE_SETS_H__
#define __GA_VALUE_SETS_H__
#include <vector>
#include "..\..\CallConvention.h"
#include "..\..\Common\GaGlobalRandomGenerator.h"
#include "..\..\Threading\GaThreading.h"
using namespace std;
namespace Chromosome
{
namespace Representation
{
// Interface for value sets
template <typename T>
class GaValueSet
{
DEFINE_SYNC_CLASS
protected:
// Indicates that when inverted value is inverted the new value is original value
bool _viceVersa;
public:
// Initialize set
GaValueSet(bool viceVersa) : _viceVersa(viceVersa) { }
// Initialize set
GaValueSet() : _viceVersa(true) { }
// Virtual destructor
virtual ~GaValueSet() { }
// Returns random value from set
virtual T GACALL GenerateRandom() const=0;
// Returns TRUE if given value belongs to set and saves inverted value
virtual bool GACALL Inverse(const T& value,
T& inverted) const=0;
// Returns TRUE if given value belongs to set
virtual bool GACALL Belongs(const T& value) const=0;
// Returns colosest value to given value
virtual const T& GACALL ClosestValue(const T& value) const=0;
// Returns TRUE if inversing the inverted value returns original value, otherwise return FALSE.
bool GACALL GetViceVersa() const
{
return _viceVersa;
}
// Sets to TRUE if inversing the inverted value returns original value.
void GACALL SetViceVersa(bool viceVersa)
{
_viceVersa = viceVersa;
}
};// END CLASS DEFINITION GaValueSet
} // Representation
} // Chromosome
#endif // __GA_VALUE_SETS_H__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -