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

📄 sacode.h

📁 用VC++编写的蚁群算法求解TSP问题的程序
💻 H
字号:
#include <vector>

struct SYCoordinate               
{
	SYCoordinate()
	{
		m_fcodx = 0.0;
		m_fcody = 0.0;
	}

	double m_fcodx;
	double m_fcody;
};

struct SYCity
{
	SYCity()
	{
		m_nIndex = 0;
		m_strName.Empty();
	}

	int m_nIndex;					//城市编号
	CString m_strName;				//城市名称
	SYCoordinate m_Coordinate;		//城市坐标
};

struct SYCityDistance
{
	SYCityDistance()
	{
		m_nFromCity = 0;
		m_nToCity = 0;
		m_fDistance = 0.0;
	}

	int m_nFromCity;				//源城市
	int m_nToCity;					//目标城市
	double m_fDistance;				//城市之间的距离
};


void InitialSA();


double CountCityDistance( SYCity &FromCity, SYCity &ToCity, SYCityDistance &CityDistance );


double calc_length();

//void moveTo(int to_city);

struct CURRENT_TOUR
{
	CURRENT_TOUR()
	{
		from_city = 0;
		to_city = 0;
	}

	int from_city;
	int to_city;
	
};






class NNAnt			//用于计算tau0
{
public:
	  //moveTo(int to_city);
	 NNAnt(int start_city);//带参数初始化
	 int choose();
	  search();
};



class ACSAnt			//用于计算tau0
{
public:
	  //moveTo(int to_city);
	 ACSAnt(int start_city);//带参数初始化
	 int choose();
	  search();
};

⌨️ 快捷键说明

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