parameter.h
来自「基本遗传算法在求一个函数表达式的最大值应用!」· C头文件 代码 · 共 36 行
H
36 行
//用于定义算法中所要用到的全局参数
#ifndef PARAMETER_H
#define PARAMETER_H
//*************算法参数***************//
class MyParameter{
public:
// 默认参数
int lchrom ; // 染色体长度= 40
int popsize ; // 种群大小= 100
double pcross ; // 交叉概率=0.6
double pmutate ; // 变异概率=0.0015
int stop_criteria; // 终止代数 = 400
int select_way; // 选择方式
MyParameter(int lch = 40,
int pops = 100,
int stopc = 400,
double pc = 0.6,
double pm = 0.0015,
int sw = 0
);
int get_lchrom(){ return this->lchrom ; }
int get_popsize(){ return this->popsize ; }
double get_pcross(){ return this->pcross ; }
double get_pmutate(){ return this->pmutate ; }
int get_stop_criteria(){ return this->stop_criteria ;}
int get_select_way(){ return select_way ;}
void set_parameter(int lch ,
int pops ,
int stopc ,
double pc ,
double pm ,
int sw
);
};
#endif ///:~PARAMETER_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?