📄 population.h
字号:
// Population.h: interface for the CPopulation class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_POPULATION_H__B2F79175_F83A_4B04_B0BB_E365068A5755__INCLUDED_)
#define AFX_POPULATION_H__B2F79175_F83A_4B04_B0BB_E365068A5755__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Chromosome.h"
class CPopulation
{
public:
CPopulation();
virtual ~CPopulation();
void Sort_SelectIndividual(); //选择个体产生下一代种群
void Wheel_SelectIndividual();
void FindBestAndWorstIndividual();
void Crossover(); //杂交
void Mutation(); //变异
void Run();
public:
const int MaxGeneration;
const double Pc;//杂交率
const double Pm;//变异率
int m_currentPopSize;//当前种群大小
int m_bestIndex;
int m_worstIndex;
int m_currentGen;
enum { M=12 }; //配送中心和用户总个数
enum { PopSize=10 };
CChromosome m_currentBestIndividual;
CChromosome m_currentWorstIndividual;
CChromosome m_individual[PopSize];
double m_F[M]; // F[i]为被选配送中心i的基本建设费用;
double m_Q[M]; //Q[i]--客户i对产品的日需求量;
double m_w[M]; // w[i]--配送中心i对产品单位流转量的管理费用;
double m_d[M][M]; //d[i][j]--配送中心i到客户j的距离;
};
#endif // !defined(AFX_POPULATION_H__B2F79175_F83A_4B04_B0BB_E365068A5755__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -