ga1.cpp
来自「本程序基于matlab 遗传算法的源程序代码」· C++ 代码 · 共 28 行
CPP
28 行
// 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 + =
减小字号Ctrl + -
显示快捷键?