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

📄 testdoc.h

📁 用C++写的函数逼近的例子!可以设置步长
💻 H
字号:
// testDoc.h : interface of the CTestDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_TESTDOC_H__EFD89CB6_5671_447C_8B60_8AA80A6B09ED__INCLUDED_)
#define AFX_TESTDOC_H__EFD89CB6_5671_447C_8B60_8AA80A6B09ED__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <fstream.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <time.h>

#define BIAS_FILE "e_system.txt"
#define BIASNUM_FILE "enum_system.txt"
#define TEMP_FILE "temp_system.txt"
#define OPTI_FILE "opti_system.txt"
#define PI 3.14159265
#define MIN_ERROR 100.0
#define TOLLERANCE 0.09
#define INCREASE_RATE 0.0018
#define LEARN_METHOD 2
#define START_METHOD 0
#define MIN_STEP 0
#define START_STEP 220
#define MAX_STEP 220
#define DELTA 1
#define ALPHA 0.99
#define CIRCLE TRUE
#define LOOP TRUE
#define MAX_DECREASE 0.98
#define MIN_DECREASE 0.02
#define DECREASE_STEP 0.02
#define START_ANGLE 30
#define MAX_ANGLE 30
#define ANGLE_STEP 5

class CTestDoc : public CDocument
{
protected: // create from serialization only
	CTestDoc();
	DECLARE_DYNCREATE(CTestDoc)

// Attributes
public:

double **input,
	**hidden,
	**output,
	**gamma,
	**target,
	*bias,
	*old_bias,
	*last_bias,
	*last_old_bias,
	*original_bias,
	**weight_i_h,
	**original_weight_ih,
	**old_weight_ih,
	**last_weight_ih,
	**last_old_weight_ih,
	**weight_h_o,
	**original_weight_ho,
	**old_weight_ho,
	**last_weight_ho,
	**last_old_weight_ho,
	*errorsignal_hidden,
	*errorsignal_output,
	*delta_error_output,
	*last_delta_error_output,
	*delta_error_hidden,
	*last_delta_error_hidden,
	**delta_weight_ho,
	**last_delta_weight_ho,
	**delta_weight_ih,
	**last_delta_weight_ih;
	

int input_array_size,
	hidden_array_size,
	output_array_size,
	max_patterns,
	bias_array_size,
	number_of_input_patterns,
	selpattern,
	ytemp,
	ztemp,
	total,
    count,
	step_rate,
	optimum_step,
	max_step,
	dispmode;

double learning_rate,
       last_original_rate,
	   original_learning_rate,
	   last_learning_rate,
	   original_rate,
	   alpha,
	   old_e,
	   last_old_e,
	   delta_e,
	   min_e,
	   back_e,
	   total_e,
	   angle,
	   optimum_decrease_length,
	   last_total_e,
	   increase_length,
	   decrease_length,
	   max_error_tollerance;

double sum;

BOOL notkeyhit,
	 can_learn,
	 file_loaded,
	 progress,
	 circle,
	 loop,
	 not_onward,
	 success,
	 data_learned;

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTestDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:
	double function(double m);
	void tracebias();
	void save_last_data();
	void read_last_data();
	void load_original_data();
	int compare_output_to_target();
	void backward_pass(ofstream& f_out, int method, ofstream& out_temp);
	void forward_pass(int pattern);
	void clear_memory();
	void initialize_net();
	virtual ~CTestDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CTestDoc)
	afx_msg void OnMenuLoad();
	afx_msg void OnMenuLearn();
	afx_msg void OnMenuNewfile();
	afx_msg void OnMenuTest();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TESTDOC_H__EFD89CB6_5671_447C_8B60_8AA80A6B09ED__INCLUDED_)

⌨️ 快捷键说明

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