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

📄 gaincrementalalgorithm.h

📁 遗传算法做的排课系统
💻 H
字号:

#ifndef __GA_INCREMENTAL_ALGORITHM_H__
#define __GA_INCREMENTAL_ALGORITHM_H__

#include <vector>
#include "..\..\ExportImport.h"
#include "..\..\CallConvention.h"
#include "..\..\Threading\GaThreading.h"
#include "..\GaMultithreadingAlgorithm.h"

namespace Population
{
	class GaPopulation;
}

using namespace std;
using namespace Threading;
using namespace Population;
using namespace Algorithm;

namespace Algorithm
{
	namespace SimpleAlgorithms
	{

		// Use overlapping population, only few chromosomes are repaced in single generation
		class GaIncrementalAlgorithm : public GaMultithreadingAlgorithm
		{

		private:

			// Algorithm's parameters
			GaMultithreadingAlgorithmParams _parameters;

			// Population
			GaPopulation* _population;

			// Buffer for selection and coupling operations
			GaCouplingResultSet* _buffer;

		public:

			// Initialize algorithm
			DLL_EXPORT
			GaIncrementalAlgorithm(GaPopulation* population,
				const GaMultithreadingAlgorithmParams& parameters);

			// Free resources
			DLL_EXPORT
			virtual ~GaIncrementalAlgorithm();

			// Returns current algorithm parameters
			DLL_EXPORT
			virtual const GaAlgorithmParams& GACALL GetAlgorithmParameters() const;

			// Sets new parameters for algorithm
			DLL_EXPORT
			virtual void GACALL SetAlgorithmParameters(const GaAlgorithmParams& parameters);

			// Returns referenct to population at given index.
			DLL_EXPORT
			virtual const GaPopulation& GACALL GetPopulation(int index) const;

			// Retruns statistical information about execution of the algorithm.
			DLL_EXPORT
			virtual const GaStatistics& GACALL GetAlgorithmStatistics() const;

		protected:

			// Initialize the algorithm
			DLL_EXPORT
			virtual void GACALL Initialize();

			// Step of control flow before workers start
			DLL_EXPORT
			virtual void GACALL BeforeWorkers();

			// One step of work flow
			DLL_EXPORT
			virtual void GACALL WorkStep(int workerId);

			// Step of control flow after workers finish
			DLL_EXPORT
			virtual void GACALL AfterWorkers();

		};// END CLASS DEFINITION GaIncrementalAlgorithm

	} // SimpleAlgorithms
} // Algorithm

#endif // __GA_INCREMENTAL_ALGORITHM_H__

⌨️ 快捷键说明

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