?? mytsp.h
字號:
#ifndef H_MYTSPNWPU
#define H_MYTSPNWPU
#include "Global.h"
/*******************************地圖信息*********************************/
class GInfo
{
public:
double m_dDeltTrial[iCityCount][iCityCount]; //信息素增量
double m_dTrial[iCityCount][iCityCount]; //信息素痕跡
double distance[iCityCount][iCityCount]; //距離
};
/*********************************螞蟻類*********************************/
class ant
{
private:
int ChooseNextCity(); //選擇下一步要到的城市
double prob[iCityCount]; //轉移概率
int m_iCityCount; //指向城市的編號
int AllowedCity[iCityCount]; //沒有走過的城市
public:
void addcity(int city); //往tabu列表中添加新的城市ID
int tabu[iCityCount]; //旅行商沿途經過的城市ID列表
void Clear();
void UpdateResult();
double m_dLength; //旅行商走一圈所走的路程
double m_dShortest; //眾多路線中最短的一條
void move();
ant();
void move2last();
};
/*********************************螞蟻的運動屬性********************************/
class project
{
public:
void UpdateTrial();
double m_dLength;
void initmap();
ant ants[iAntCount];
void GetAnt();
void StartSearch();
project();
city cc[iCityCount];
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -