dparticle.cpp

来自「蚁群算法解决车辆最优路径问题」· C++ 代码 · 共 42 行

CPP
42
字号
// DPARTICLE.cpp: implementation of the DPARTICLE class.
//
//////////////////////////////////////////////////////////////////////

#include "DPARTICLE.h"
#include <stdlib.h>



//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

DPARTICLE::DPARTICLE() //空构造函数
{

}
DPARTICLE::DPARTICLE(int n) //维数为参数的构造函数
{
	Dim = n;
}

//微粒析构函数
DPARTICLE::~DPARTICLE()
{
	delete [] X;
	X = NULL;
	delete [] V;
	V = NULL;
	delete [] XBest;
	XBest = NULL;
}

//设置微粒的维数
void DPARTICLE::SetDim(int d)
{
	Dim = d;
	X = new int [Dim];
	V = new int [Dim*Dim];
	XBest = new int [Dim];
}

⌨️ 快捷键说明

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