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

📄 evaluationtsp.cpp

📁 c++语言实现的遗传算法的例子,需要的快下啊
💻 CPP
字号:
// EvaluationTSP.cpp: implementation of the EvaluationTSP class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "EvaluationTSP.h"

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

EvaluationTSP::EvaluationTSP(int s)
{
	scale=s;
}

void EvaluationTSP::SetOptim(ParticleTSP * * sworm,int * gb)
{
	double temp;
	double p=sworm[*gb]->GetOS();
	for(int j=0;j<scale;j++)
	{
		if(sworm[j]->GetSolution()>sworm[j]->GetOS())
		{
			sworm[j]->SetIO();
		}
		temp=sworm[j]->GetOS();
		if(temp>p) 
		{
			p=temp;
			*gb=j;
		}
	}
}

EvaluationTSP::~EvaluationTSP()
{

}

⌨️ 快捷键说明

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