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

📄 sa.h

📁 利用模拟退火算法解决TSP问题.很经典的一个算法.使用中国144个城市测试,在很短的时间内找到的比较好的解.
💻 H
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -