⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gene.h

📁 Genetic Algorithm (GA) based solver for the Traveling Salesman Problem
💻 H
字号:
// gene.h// Declaration of class Gene// Thomas Pederson, 950505#ifndef GENE#define GENE#include "global.h"#include <iostream.h>class Gene{   public:   Gene(char *_name, coord_t _x, coord_t _y,	unsigned int _index, unsigned int _distVecLength);   ~Gene();      // Calculates Eucledian distance between this gene and _gene and returns the value.   distance_t calculateDistanceTo(Gene& _gene);   // Returns Eucledian distance between this gene and _gene.   distance_t distanceTo(Gene& _gene);   // Returns this gene's index in original chromosome pool.   unsigned int getIndex() {return index;}   // Returns this gene's name.   char *getName() {return name;}   // Prints gene information to stream.   friend ostream& operator<<(ostream& outStr, Gene& gene);      private:   distance_t *distance; // distance vector   unsigned int distVecLength; // length of distance vector   char *name; // name of gene   coord_t x,y; // gene's coordinates   unsigned int index; // gene's index};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -