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