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

📄 mysaaview.h

📁 平台vs2005 模拟固体退火算法实现144个城市的旅行商问题
💻 H
字号:
// MySAAView.h : CMySAAView 类的接口
//


#pragma once


class CMySAAView : public CView
{
public: // 仅从序列化创建
	CMySAAView();
	DECLARE_DYNCREATE(CMySAAView)

// 属性
public:
	CMySAADoc* GetDocument() const;

// 操作
public:

// 重写
public:
	virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	
protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);

// 实现
public:
	void OnErZhi();                //使用2变换法执行退火算法
	virtual ~CMySAAView();

	//计算路径长度
	double ComputeResult();

	//临时数组中的路径长度
//	double TempComputeResult();

	//变换路径,结果保存在TempCity中,采用2变换法
	double Generate();

	//计算city中两城市的路程
	double CityComputeSqrt( int n );

	double TemCityComputeSqrt( int n );

	void SAA();

public:
	int City[144][2];            //路径

	int TempCity[144][2];        //临时路径

	double T ;               //温度

	double Excell;    //存放算法过程中的最优解

	int ExCity[144][2];    //存放算法过程中最优解的数组

	int L;

	double TGene;

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// 生成的消息映射函数
protected:
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // MySAAView.cpp 中的调试版本
inline CMySAADoc* CMySAAView::GetDocument() const
   { return reinterpret_cast<CMySAADoc*>(m_pDocument); }
#endif

⌨️ 快捷键说明

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