📄 parameter.h
字号:
//用于定义算法中所要用到的全局参数
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -