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

📄 main.cpp

📁 标准pso算法
💻 CPP
字号:
// pso.cpp : Defines the entry point for the console application.

#include <iostream.h>
#include <cmath>
#include "pso.h"
#include "pso.cpp"
//申明相关数据
const int PNum = 20;            //微粒个数
const int PDim = 20;            //微粒维数
const int MAX_NUM = 2000;        //最大迭代次数 

int main(void)
{
	double bestfit;
	
	PSO pso(PNum, PDim); 
	pso.SetC1(1.494);
	pso.SetC2(1.494);
	pso.SetW(0.729);
	pso.SetXmax(5.12); 
	pso.SetVmax(5.12); 
	cout<<"\nRun Now:\n";
    bestfit = (pso.Run(MAX_NUM)).BestFit; 
	cout<<"\nThe Result is:\t"<<bestfit<<"\n"; 
	
    return 0;
}

⌨️ 快捷键说明

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