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

📄 childview.h

📁 采用visual c解决tsp问题。里面有遗传算法的选择、交叉、变异函数。
💻 H
字号:

/*
 * 
 * website: http://www.coolsoft-sd.com/
 * contact: support@coolsoft-sd.com
 *
 */

/*
 * Genetic Algorithm Library
 * Copyright (C) 2007-2008 Coolsoft Software Development
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 */

#pragma once

#include "TspAlgorithm.h"

// CChildView window

class CChildView : public CWnd,
	GaObserver
{

	DEFINE_SYNC_CLASS

// Construction
public:
	CChildView();

// Attributes
public:

	// Notifies the observer that new statistical information is available
	virtual void GACALL StatisticUpdate(const GaStatistics& statistics,
		const GaAlgorithm& algorithm);

	// Notifies observer that new best chromosome has found
	virtual void GACALL NewBestChromosome(const GaChromosome& newChromosome,
		const GaAlgorithm& algorithm);

	// Notifies observer that state of evolution (problem sloving) has changed.
	virtual void GACALL EvolutionStateChanged(GaAlgorithmState newState,
		const GaAlgorithm& algorithm) { }

private:

	GaCriticalSection _algControlSect;
	vector<const TspCity*> _bestChromosome;

	int _generation;
	float _fitness;

// Operations
public:

// Overrides
	protected:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);

// Implementation
public:
	virtual ~CChildView();

	// Generated message map functions
protected:
	afx_msg void OnPaint();
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);

	afx_msg void OnStart();
	afx_msg void OnPause();
	afx_msg void OnStop();
};

⌨️ 快捷键说明

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