sharingscaling.h
来自「我自己写的一个用于图编码的遗传算法」· C头文件 代码 · 共 55 行
H
55 行
#ifndef SHARING_SCALING_H_
#define SHARING_SCALING_H_
#include "ScalingScheme.h"
#include "Genome.h"
#include "Comparator/Comparator.h"
class SharingScaling :public ScalingScheme
{
public:
SharingScaling(Comparator* func, double cut=ScalingScheme::DefSharingCutoff, double a=1.0)
{
N=0;
d=(double*)0;
df=func;
_sigma = cut;
_alpha = a;
_minmax = 0;
}
SharingScaling(double cut=ScalingScheme::DefSharingCutoff, double a=1.0)
{
N=0;
d=(double*)0;
//df=0;
_sigma = cut;
_alpha = a;
_minmax = 0;
}
void applyScaling(Population* pop);
void setDistanceFunction(Comparator* f) { df=f; }
Comparator* getDistanceFunction() const { return df; }
double sigma(double);
double sigma() const { return _sigma; }
double alpha(double c) { return _alpha = c; }
double alpha() const { return _alpha; }
int minimaxi(int i);
int minimaxi() const { return _minmax; }
private:
Comparator* df; // the user-defined distance function
unsigned int N; // how many do we have? (n of n-by-n)
double *d; // the distances for each genome pair
double _sigma; // absolute cutoff from central point
double _alpha; // controls the curvature of sharing f
int _minmax; // should we minimize or maximize?
};
#endif//SHARING_SCALING_H_
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?