count.h

来自「用遗传算法实现巡回旅行商(邮差问题)的程序。可自由设置城市位置及数目」· C头文件 代码 · 共 47 行

H
47
字号
// 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 + =
减小字号Ctrl + -
显示快捷键?