tsp_acs.h

来自「TSP的智能算法」· C头文件 代码 · 共 76 行

H
76
字号
///////////////////////////////////////////////////////////
// This virsion is AntSystem 1.0
// author: zhaochaoqing ChongQing University
//
//the author can be contacted at:
//   Email: zh_iostream@126.com
//
////////////////////////////////////////////////////////////

//
// TSP_ACS.h :interface for TPS_ACS class
////////////////////////////////////////////////////////////


#if !defined(AFX_TSP_ACS_H__1E28E5C9_F573_4884_8326_72ECBF8C2D91__INCLUDED_)
#define AFX_TSP_ACS_H__1E28E5C9_F573_4884_8326_72ECBF8C2D91__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "TSP_Generic.h"
class TSP_Ant;

class TSP_ACS : public TSP_Generic  
{
public:
	TSP_ACS();
	virtual ~TSP_ACS();

private:
	// tau, dist and vis matrices
	double** m_aTau;
	int**	 m_aDist;
	double** m_aVis;

	// other constants
	int     m_nAlpha;
	int		m_nBeta;
	double	m_dRho;
	double  m_dQ0;
	int		m_nM;
	double	m_dTau0;

	int		m_nTMax;	// how many times to repeat

	CTypedPtrArray<CPtrArray, TSP_Ant*> m_aAnts;	// ants

// operations
private:
	void DestroyAnts();
	void CreateAnts();

public:
	virtual void Initialize();
	virtual void ComputeTour();

	double	GetTauAt(int i, int j) const		{return m_aTau[i][j];}
	int		GetDistAt(int i, int j) const		{return m_aDist[i][j];}
	double	GetVisAt(int i, int j) const		{return m_aVis[i][j];}
	void	SetTauAt(int i, int j, double dTau)	{m_aTau[i][j] = dTau;}
	void	SetDistAt(int i, int j, int nDist)	{m_aDist[i][j] = nDist;}
	void	SetVisAt(int i, int j, double dVis)	{m_aVis[i][j] = dVis;}

	double	GetTau0() const	{return m_dTau0;}
	int      GetAlpha() const{return m_nAlpha;}
	int		GetBeta() const	{return m_nBeta;}
	double	GetRho() const	{return m_dRho;}
	double  GetQ0() const	{return m_dQ0;}
	int		GetM() const	{return m_nM;}
	int		GetTMax() const	{return m_nTMax;}

};

#endif // !defined(AFX_TSP_ACS_H__1E28E5C9_F573_4884_8326_72ECBF8C2D91__INCLUDED_)

⌨️ 快捷键说明

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