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

📄 count.h

📁 用遗传算法实现巡回旅行商(邮差问题)的程序。可自由设置城市位置及数目
💻 H
字号:
// count.h: interface for the count class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_COUNT_H__10ED3660_D4DB_42D9_95CC_3F782D677E95__INCLUDED_)
#define AFX_COUNT_H__10ED3660_D4DB_42D9_95CC_3F782D677E95__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
struct CityMsg
	{
		int *citynum;
		double fitness;
	};
class count  
{
public:
	
	struct CityMsg *city,*newcity;
	int maxindiv;
	int maxgen;
	int citysum;
	double fit_t;//适应度参数,fitness=fit_t- s .
	double crossrate;
	CPoint *citysite;


public:
	void variation();
	count();
	virtual ~count();
	void init();//初始化
	int setcitynum(int,int);
	void countaroundlength(struct CityMsg *);
	void setfitness_t(struct CityMsg *);
	void setfitness(struct CityMsg *);

	void producegen();
	int selectindiv();
	void crossover(int,int,int,int);


};

#endif // !defined(AFX_COUNT_H__10ED3660_D4DB_42D9_95CC_3F782D677E95__INCLUDED_)

⌨️ 快捷键说明

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