Files
envi-code/SourceCode/Code2026/tg_shs/inc/subgeo/TGAPopulation.h
T

59 lines
1.2 KiB
C++
Raw Normal View History

2026-10-04 00:04:20 +08:00
//-------------------------------------------------------------------------------------------------------+
2026-09-28 15:28:50 +08:00
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
2026-10-04 00:04:20 +08:00
// = FileName : TGAPopulation 类
2026-09-28 15:28:50 +08:00
// = Version : ver2.0
// = Author : wlw
// = CreateDate : 2002-09-09
2026-10-04 00:04:20 +08:00
// = Description: TGAPopulation 声明
2026-09-28 15:28:50 +08:00
// = Maintainers:
//
//-------------------------------------------------------------------------------------------------------+
#ifndef _TGAPOPULATION_H_
#define _TGAPOPULATION_H_
#ifndef _TPDLIST_H_
#include "TPDList.h"
#endif
#ifndef _TGAINDIVIDUAL_H_
#include "TGAIndividual.h"
#endif
class GEOAPI TGAPopulation : public TPDList<TGAIndividual>
{
public:
TGAPopulation();
virtual ~TGAPopulation();
virtual bool IsContinue();
virtual void Step();
2026-10-04 00:04:20 +08:00
//种群进化单元,后代仍然有序
2026-09-28 15:28:50 +08:00
virtual void Evolve();
void SetMaxNum(long num);
long GetMaxNum() const;
void SetMutationRatio(long r);
long GetMutationRatio();
2026-10-04 00:04:20 +08:00
//增加新个体,排序,果总数超限,淘汰最后一个。
2026-09-28 15:28:50 +08:00
void Append(TGAIndividual* pNew);
protected:
2026-10-04 00:04:20 +08:00
//允许最大数量
2026-09-28 15:28:50 +08:00
long m_iMaxNum;
2026-10-04 00:04:20 +08:00
//变异百分比
2026-09-28 15:28:50 +08:00
long m_iMutationRatio;
2026-10-04 00:04:20 +08:00
//进化计数
2026-09-28 15:28:50 +08:00
long m_iEvolution;
};
#endif