资源描述:
《用于 tsp 问题的克隆选择算法》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、用于TSP问题的克隆选择算法#include"stdafx.h"#include"TSP.h"#include"stdlib.h"#include"TSPDoc.h"#include"TSPView.h"#include"math.h"#include"conio.h"#include"time.h"#include"afx.h"#ifdef_DEBUG#definenewDEBUG_NEW#undefTHIS_FILEstaticcharTHIS_FILE[]=__FILE__;#endif//////////////////////////////////////////
2、/////////////////////////////////////CTSPViewIMPLEMENT_DYNCREATE(CTSPView,CFormView)BEGIN_MESSAGE_MAP(CTSPView,CFormView)//{{AFX_MSG_MAP(CTSPView)ON_BN_CLICKED(IDC_BUTTON_input,OnBUTTONinput)34ON_BN_CLICKED(IDC_BUTTON_Clone,OnBUTTONClone)ON_BN_CLICKED(IDC_BUTTON2,OnOK)ON_WM_PAINT()//}}AFX_M
3、SG_MAP//StandardprintingcommandsON_COMMAND(ID_FILE_PRINT,CFormView::OnFilePrint)ON_COMMAND(ID_FILE_PRINT_DIRECT,CFormView::OnFilePrint)ON_COMMAND(ID_FILE_PRINT_PREVIEW,CFormView::OnFilePrintPreview)END_MESSAGE_MAP()////////////////////////////////////////////////////////////////////////////
4、///CTSPViewconstruction/destructionCTSPView::CTSPView():CFormView(CTSPView::IDD){//{{AFX_DATA_INIT(CTSPView)m_popsize1=0;m_lchrom1=0;m_maxgen1=0;m_pcross1=0.9;m_pmutation1=0.1;m_maxfitness=0.0;m_avgfitness=0.0;m_minfitness=0.0;//m_sunfitness=0.0;//m_gen=0;m_maxfitness2=0.0;m_avgfitness2=0.0
5、;m_minfitness2=0.0;//m_sunfitness2=0.0;//m_fname=_T("");//m_bestPop=_T("");//}}AFX_DATA_INIT//TODO:addconstructioncodehere}CTSPView::~CTSPView(){//if(oldpop!=NULL)//delete(oldpop);}35voidCTSPView::DoDataExchange(CDataExchange*pDX){CFormView::DoDataExchange(pDX);//{{AFX_DATA_MAP(CTSPView)DDX
6、_Text(pDX,IDC_EDIT1,m_popsize1);DDX_Text(pDX,IDC_EDIT2,m_lchrom1);DDX_Text(pDX,IDC_EDIT3,m_maxgen1);DDX_Text(pDX,IDC_EDIT4,m_pcross1);DDX_Text(pDX,IDC_EDIT5,m_pmutation1);DDX_Text(pDX,IDC_EDIT12,m_maxfitness);DDX_Text(pDX,IDC_EDIT13,m_avgfitness);DDX_Text(pDX,IDC_EDIT14,m_minfitness);//DDX_
7、Text(pDX,IDC_EDIT15,m_sunfitness);//DDX_Text(pDX,IDC_EDIT20,m_gen);DDX_Text(pDX,IDC_EDIT21,m_maxfitness2);DDX_Text(pDX,IDC_EDIT22,m_avgfitness2);DDX_Text(pDX,IDC_EDIT23,m_minfitness2);//DDX_Text(pDX,IDC_EDIT24,m_sunfitness2);//DDX_Text(pDX,IDC_EDIT26,m_f