?? garepresentationinterfaces.h
字號(hào):
#ifndef __GA_REPRESENTATION_INTERFACES_H__
#define __GA_REPRESENTATION_INTERFACES_H__
#include <vector>
#include "..\GaChromosome.h"
#include "..\..\CallConvention.h"
#include "GaCodeValuesBuffer.h"
#include "GaValueSets.h"
using namespace std;
using namespace Chromosome;
using namespace Chromosome::Representation;
namespace Chromosome
{
namespace Representation
{
// Interface for elements (or parts) of chromosome's code
class GaCodeValue
{
public:
// Initialize data
virtual void GACALL Initialize()=0;
// Gets value from buffer
virtual void GACALL FromBuffer(const GaCodeValuesBuffer& buffer,
int pos)=0;
};// END INTERFACE DEFINITION GaCodeValue
// Interface for chromosome's representations which parts of the code can be randomly muteted or inverted.
class GaMutableCode
{
public:
// Randomly change the values of selected part of chromosome's code
virtual void GACALL Flip(int start,
int size)=0;
// Inverts data in selected part of chromosome's code
virtual void GACALL Invert(int start,
int size)=0;
};// END INTERFACE DEFINITION GaMutableCode
// Interface for chromosome's representations which part of the code can be swapped
class GaSwapableCode
{
public:
// Swap parts of chromosome's code
virtual void GACALL Swap(int start1,
int size1,
int start2,
int size2)=0;
};// END INTERFACE DEFINITION GaSwapableCode
// Interface for chromosome's representations which code can be varible length.
class GaSizableCode
{
public:
// Removes part of chromosome's code
virtual void GACALL Remove(int start,
int size)=0;
// Inserts information int chromosome's code
virtual void GACALL Insert(int start,
GaCodeValue* data,
int size)=0;
};// END INTERFACE DEFINITION GaSizableCode
// Interface for chromosomes which codes are representet with multiple values
class GaMultiValueCode
{
public:
// Makes new buffer for manupulatin parts of chromosome's code
virtual GaCodeValuesBuffer* GACALL MakeBuffer(int size) const=0;
// Fills buffer with part of chromosome's code
virtual void GACALL FillBuffer(int pos,
int size,
GaCodeValuesBuffer& buffer) const=0;
// Makes chromosome's code from buffer of values
virtual void GACALL FromBuffer(const GaCodeValuesBuffer& buffer)=0;
};// END INTERFACE DEFINITION GaMultiValueCode
// Interface for chromosomes having code which can be used by arithmetical operations
class GaArithmeticalCode
{
public:
// Returns new chromosome with code whic is made by adding values in two givne chromosomes' codes
virtual GaChromosomePtr GACALL operator +(const GaArithmeticalCode& rhs) const=0;
// Returns new chromosome with code whic is made by substracting values in two givne chromosomes' codes
virtual GaChromosomePtr GACALL operator -(const GaArithmeticalCode& rhs) const=0;
// Returns new chromosome with code whic is made by multiplying values in two givne chromosomes' codes
virtual GaChromosomePtr GACALL operator *(const GaArithmeticalCode& rhs) const=0;
// Returns new chromosome with code whic is made by dividing values in two givne chromosomes' codes
virtual GaChromosomePtr GACALL operator /(const GaArithmeticalCode& rhs) const=0;
// Returns new chromosome with code whic is midpoint between two givne chromosomes
virtual GaChromosomePtr GACALL Midpoint(const GaArithmeticalCode& c) const=0;
};// END INTERFACE DEFINITION GaArithmeticalCode
} // Representation
} // Chromosome
#endif // __GA_REPRESENTATION_INTERFACES_H__
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -