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

📄 ga1.cpp

📁 本程序基于matlab 遗传算法的源程序代码
💻 CPP
字号:
// Ga1.cpp : Defines the entry point for the console application.

#include <iostream>
#include <ctime>
#include "MyRan.h"
#include "MyGa.h"
int main(int argc, char* argv[])
{
	using namespace std;
	ProeGa::spand();
	ProeGa::Ga1  mm;
	for(int i=0;i<1000;i++)
	{
		mm.Intersect();
		if (i>100)
		//mm.Param.pm=0.1;
		//mm.Param.pc=0.2;
		mm.varia();
		mm.Sort();
		for(int j=0;j<2;j++)
		cout << mm.Parent[0].Gene[j]<<"  ";
		cout<< mm.Parent[0].Fitness;
		cout << endl;
	}
	return 0;
}

⌨️ 快捷键说明

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