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

📄 viewh.txt

📁 蚁群算法是解决电力调配系统和商场供货系统问题的有效算法,这里提供了一种蚁群算法,供大家参考
💻 TXT
字号:
// ACSView.h : interface of the CACSView class
//
/////////////////////////////////////////////////////////////////////////////
#include "InputXYDlg.h"
#if !defined(AFX_ACSVIEW_H__B12D58ED_2737_11D3_8537_0060088C9F04__INCLUDED_)
#define AFX_ACSVIEW_H__B12D58ED_2737_11D3_8537_0060088C9F04__INCLUDED_

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


class CACSView : public CFormView
{
protected: // create from serialization only
	CACSView();
	DECLARE_DYNCREATE(CACSView)

public:
	//{{AFX_DATA(CACSView)
	enum{ IDD = IDD_ACS_FORM };
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA

// Attributes
public:
	CACSDoc* GetDocument();
	
// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CACSView)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnInitialUpdate(); // called first time after construct
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnDraw(CDC* pDC);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CACSView();
public:
	void OnWizard();
	void CalculateAvergeLengtn();
	void DrawToScreen();
	void BeginAsbaSort();
	void GetInitialValue();
	void UpdateAllTour();
	void GetBestTour();
	void ComputeTourLength();
	void BeginTour();
	void AcceptValueFormDoc();


//	CInputXYDlg inputdlg;	// 没有意义的项.
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CACSView)
	afx_msg void OnMenuSetdefaultparam();
	afx_msg void OnMenuisetinitial();
	afx_msg void OnMenurunprogram();
	afx_msg void OnAcsHelp();
	afx_msg void OnMenusortSelect();
	afx_msg void OnMenusortSetparam();
	afx_msg void OnMenusortRun();
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	//这些变量用于TSP问题;
	int m_CityNum;
	int m_AntNum;
	int index;//generic a random number
	double q;
	int firstcity;
	int qqq;
	int num,next;
	int antnum;
	double m_T0Value;
	double m_T[MAX_SIZE][MAX_SIZE];//存储信息素变量;
	double	m_BValue;
	double	m_Q0Value;
	double	m_QValue;
	double	m_AValue;
	double	m_PValue;
	double	m_TValue; 
	double totalparam;
	double totalLength;
	double avergeLength;
	int nextcity;
	double exploitation[MAX_SIZE];
	double exploration[MAX_SIZE];
	double distance[MAX_SIZE];//两点间距离;
	double antTour[MAX_SIZE];//存储每只蚂蚁走过的路径;
	double tourbyant[MAX_SIZE];//ant k visited tour length
	double bestTourLength;//最优路径长度;
	int bestTourPos;//取得最优路径的蚂蚁的位置
	int ant[MAX_SIZE];//蚂蚁数组.
	CPoint sk;//下一个访问的点
	CPoint rk;//当前访问结点
	CPoint rk1;//初始点
	CPoint tour[MAX_SIZE];
	CPoint freshcity[MAX_SIZE];
	CArray <CPoint,CPoint> city;//城市集合
	CArray <CPoint,CPoint> citySet[MAX_SIZE];//存放未被访问的城市集合
	CArray <CPoint,CPoint>order[MAX_SIZE];//记录最优路径顺序的集合
//以下的变量用于工件排序问题;
private:
	int m_question;//决定选取问题的变量0-7*3;1-40*10;
	int relation[100][100];//工件和机器间的时间关系,即算法中的距离
	int m_ComponentNum;//工件数目
	int m_MachineNum;//机器数目
	int randnumber;
	int machinenumber;
	int componentnumber;
	double m_xinxisu[MAX_SIZE][MAX_SIZE];
	double xuanze1[MAX_SIZE];

	double shuzu1[MAX_SIZE][MAX_SIZE];
	double shuzu2[MAX_SIZE][MAX_SIZE];
	double relaiton[MAX_SIZE][MAX_SIZE];
	float	m_bInitial;
	float	m_q0Initial;
	float	m_aInitial;
	float	m_xInitial;
	float	m_t0Initial;

	int iniComponent;
	int iniMachine;
	int nextcomponent;
	int nextmachine;
	double m_q;

//	CObArray component;
//	CObArray componentSet[MAX_SIZE];//未被访问的集合
//	CObList machine[MAX_SIZE];//存放每台机器的解集
	CArray <int,int> component;
	CArray <int,int>componentSet[MAX_SIZE];
	CArray <int,int>machine[MAX_SIZE];
	
};

#ifndef _DEBUG  // debug version in ACSView.cpp
inline CACSDoc* CACSView::GetDocument()
   { 
	return (CACSDoc*)m_pDocument; 
	}
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_ACSVIEW_H__B12D58ED_2737_11D3_8537_0060088C9F04__INCLUDED_)

⌨️ 快捷键说明

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