chromosome.hpp
来自「遗传算法(Genetic Algorithm)是一类借鉴生物界的进化规律(适者生」· HPP 代码 · 共 39 行
HPP
39 行
/***************************************************************/* Single & Multi-Objective Real-Coded Genetic Algorithms Code *//* Author: Kumara Sastry *//* Illinois Genetic Algorithms Laboratory (IlliGAL) *//* Deparment of General Engineering *//* University of Illinois at Urbana-Champaign *//* 104 S. Mathews Ave, Urbana, IL 61801 *//***************************************************************/#ifndef _CHROMOSOME_H#define _CHROMOSOME_H#include "globalSetup.hpp"#include "random.hpp"#include <iostream>extern GlobalSetup *globalSetup;extern Random myRandom;class Chromosome{ private: double *genes; public: Chromosome(); Chromosome(const Chromosome &chrom); ~Chromosome(); inline void setValue(const int &locus, const double &value) { genes[locus] = value; } inline double &operator[](const int &locus) const { return genes[locus]; } void mutateMinMax(const int *freezeMask); void mutateNormal(const int *freezeMask); void mutatePolynomial(const int *freezeMask); void mutatePolynomial(const int index); Chromosome &operator= (const Chromosome &sourceChrom); friend std::ostream &operator<< (std::ostream &out, Chromosome &chrom);};#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?