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

📄 uofsolver.h

📁 遗传算法vc++语言版源程序,台湾大学编写。
💻 H
字号:
#ifndef _UOFSOLVER_
#define _UOFSOLVER_

#include "UOFId.h"
#include "UOFTerminator.h"
#include "UOFInitializer.h"
#include "UOFEvaluator.h"
#include "UOFProblem.h"

//! Basic Solver class
/*! Users should overrides this class if you define a new solver*/
class UOFSolver : public UOFId
{
public:
	UOFIdentity("UOFSolver class",1);

public:
	//! A constructor that generates a object with initialization.
	/*!
	  \param init the pointer of initializer.
	  \param eval the pointer of evaluator.
	*/	UOFSolver(UOFInitializer *init, UOFEvaluator *eval);	virtual ~UOFSolver(){}
	//! Initialize this solver.
	/*!	This is an abstract function, User must override this function to work.	This function should performs the necessary initialization procedure.	*/	virtual void	Initialization()=0;
	//! Configure this solver from a file
	/*!	This is an abstract function, User must override this function to work.	This function should configure this solver from a file, the file format is defined by the provider of this solver.	 \param filename the file name of the file to configure this solver.	*/
	virtual	bool	Configuration(const char *filename)=0;
	//! Perform Optimization procedure
	/*!	This is an abstract function, User must override this function to work.	This is the major function of UOFSolver, this function should performs the optimization procedure.	*/
	virtual	void	Solve() = 0;

	//! Set the terminator of this solver.
	/*!	This function set the stopping criteria of this solver to a defined terminator.	 \param term the pointer of the target terminator	*/
	virtual void	SetTerminator(UOFTerminator *term){m_pTerm = term;}
	//! Check if current status is certified to stop the optimization procedure.
	/*!	This function check if current status is certified to stop the optimization procedure, 	if the stopping criteria in the m_pTerm is matched, this function returns ture, otherwise returns false.	*/
	virtual bool	Done(){return (*m_pTerm)(this);}

	UOFTerminator		*m_pTerm;	/**< the pointer of the target terminator */
	UOFProblem			*m_pPrlm;	/**< the pointer of the problem to be solved */
protected:
	UOFInitializer		*m_pInit;	/**< the pointer of the initializer of the parameters */
	UOFEvaluator		*m_pEval;	/**< the pointer of the evaluator of the problem */
};
#endif

⌨️ 快捷键说明

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