📄 chromosome.h
字号:
//对染色体的结构定义
#ifndef CHROMOSOME_H
#define CHROMOSOME_H
//my codes
#include "Gene.h"
#include "parameter.h"
#include <iostream>
#include <string>
extern MyParameter myparameter;
class Chromosome{
private:
int Length;
double Fitness;
void set_length(int len);
protected:
//
public:
Gene *myGenes; // the genes
Chromosome(int all = myparameter.lchrom);
Chromosome(const Chromosome & c);
~Chromosome();
void set_fitness(double fit);
double get_fitness();
int get_length();
std::string genes_to_string();
void copyGene(Gene * gen,int offset ,int index );
void evaluate();
void tocross(Chromosome & c ,int index);
void mutate(double pmut = myparameter.pmutate );
};
#endif ///:~CHROMOSOME_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -