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

📄 sgaoptimize.h

📁 vc编程实现bp神经网络
💻 H
字号:
// SGAOptimize.h: interface for the CSGAOptimize class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SGAOPTIMIZE_H__71BCB4F2_BB3D_46DF_BB34_9D6472871705__INCLUDED_)
#define AFX_SGAOPTIMIZE_H__71BCB4F2_BB3D_46DF_BB34_9D6472871705__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define stipulate 
#define target

#include "individual.h"
#include "SGAParams.h"
#include "StringResolution.h"

class CSGAOptimize  
{
public:
	void PerformEvolution(void);
	void EvaluatePopulation(void);
	void GenerateNextPopulation(void);
	void GenerateInitialPopulation(void);
	CSGAOptimize();
	virtual ~CSGAOptimize();
protected:
	void MutationOperator(void);
	void CrossoverOperator(void);
	void SelectionOperator(void);
	void FideBestAndWorstIndividual(void);
//	void CalculateFitnessValue(void);
	void CalculateObjectValue(void);
	const long DecodeChromosome(const char * chrom,const int point,const int length);

/*	enum EvaluateFlag	// 优化目标
	{
		MAXIMIZATION=1,
		MINIMIZATION=2
	} FunctionMode;*/

	/*
	 *	特殊函数求全局最大值
	 *	1.Rosenbrock 函数 
	 *	2.定义域转换 函数
	 */
//	double target_function(double x1, double x2) { return (100*(x1*x1-x2)*(x1*x1-x2)+(1-x1)*(1-x1)); }
    //此处把target_function()函数改为你的函数,作为计算,提供给我Y的值
	double stipulate_function(long yi);

	//	double stipulate_function(long yi) { return (4.096*yi/524287.0-2.048); }
	/*
	 *	the definition of user data
	 *	for different problem, there are some difference
	 */

	int variablenocount;//记录的是该变量是第几个变量,供stipulate_function用
	int best_index;		// index of best individual
	int worst_index;	// index of worst individual
	
public:		
	/*
	*	the definition of data structure
	*/
	 CSGAParams params;	// basic genetic params
	 individual unit;   //定义一个个体对象
	 int generation;		// 遗传代数
	 individual * population,* bestindividual,* worstindividual,* currentbest;

 private:
	CStringResolution m_formula1;
};

#endif // !defined(AFX_SGAOPTIMIZE_H__71BCB4F2_BB3D_46DF_BB34_9D6472871705__INCLUDED_)

⌨️ 快捷键说明

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