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

📄 pso_km.txt

📁 毕设题目
💻 TXT
字号:

#include <iostream> 
#include <fstream> 
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <afx.h>
#include <string.h>
#include <math.h>

using namespace std; 
#define square(x) ((x)*(x))
#define DIMEN_MAX  20
#define POP_MAX	   40			// 粒子群群体规模
#define coe	       1            //粒子适应度系数

#define LOOP_MAX	10000		//循环最大次数
#define WU			0.9			//权重系数
#define WB			0.4			//权重系数
#define C1			2.0			//调节参数
#define C2			2.0			//调节参数
#define	RANGE		1000.0
#define START		-500.0

#define V_MAX	   1000         //速度最大值
#define FRAND()	   (double(rand())/RAND_MAX) //随机的位于0到1之间的数

//二维结构体
struct point2d
{
    public: double x,y;
	int cluster[POP_MAX];       //所属类号
};


point2d * centroid;    //存放中心点
point2d * set;         //存放样本点
//int *nb;               //纪录类的个数

//粒子结构体
struct particle
{
	point2d position[DIMEN_MAX];		//位置,二维的
	point2d velocity[DIMEN_MAX];		//速度,二维的			

⌨️ 快捷键说明

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