📄 simplega.h
字号:
// SimpleGA.h: interface for the CSimpleGA class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SIMPLEGA_H__E47D3572_29C8_49C7_B803_B98CEB213997__INCLUDED_)
#define AFX_SIMPLEGA_H__E47D3572_29C8_49C7_B803_B98CEB213997__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "GAUnite.h"
#include "windows.h"
class CSimpleGA
{
public:
int m_iPopuSize;//群体总数
CGAUnite *m_lpParents,*m_lpFilials;//父代个体,子代个体
double m_dSumFitness;//群体适应度总和
long int m_lMatingTimes,m_lMutationTimes;//交配、变异次数统计
double m_dMaxFitness;//最大适应度
double m_dAverageFitness;//平均适应度
int m_iMaxLocation;//最大适应度个体位置
double m_dMutationP,m_dCrossingP;//变异率 交叉率
double m_dAffinity;//个体近似度
int m_position;
int m_count;
int m_nowp;
double last_maxfitness;
void Initial(int pop_size,double mutation_p,double crossing_p);//初始化交配池函数
virtual Statistic();//统计函数
int Selection();// 选择函数
int Flip(double probability);//FLIP实验函数
int Mutation(unsigned int loca);//变异函数
int Mating(unsigned int *parent1_chain1,unsigned int *parent1_chain2,
unsigned int *parent2_chain1,unsigned int *parent2_chain2,
int k5);//交配函数
void Generation(void);//代进化函数
void NextGeneration(void);//父代、子代一致函数
void ReportGeneration(void);//一代个体报告函数
void FreeSpace();//释放内存空间
void CalcuAffinity();//个体近似度计算
int SaveDate(LPCTSTR filename,char if_rewrite);
int SaveCount(LPCTSTR filename,int count);
CSimpleGA();
virtual ~CSimpleGA();
};
#endif // !defined(AFX_SIMPLEGA_H__E47D3572_29C8_49C7_B803_B98CEB213997__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -