sa.h
来自「利用模拟退火算法解决TSP问题.很经典的一个算法.使用中国144个城市测试,在很」· C头文件 代码 · 共 33 行
H
33 行
#ifndef SA_TSP_LiuYongJin_2008_03_20_CSD_XMU
#define SA_TSP_LiuYongJin_2008_03_20_CSD_XMU
typedef struct _path
{
double Length;
int *Citys;
}Path;
typedef struct _posi
{
int x, y;
}Position;
//模拟退火算法
class CSaTsp
{
public:
CSaTsp(char *datafile);
~CSaTsp();
int GetNumCitys();
Position *GetPosition();
void GetBestPath(Path *path);
private:
int m_nCity; //城市个数
Position *m_xyPosition; //每个城市的坐标
Path *m_curPath, *m_newPath, *m_globalPath;
void Init();
double NewPath();
void UpdateBestPath();
double m_Temperature;
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?