(
// 遗传算法Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "遗传算法.h"
#include "遗传算法Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlg dialog
CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyDlg)
m_height = 1000;
m_width = 2000;
m_pxCross = 0.5;
m_pMutation = 0.02;
m_FilePath = _T("");
m_GenS = 50;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
//{{AFX_DATA_MAP(CMyDlg)
DDX_Text(pDX, IDC_HEIGHT, m_height);
DDV_MinMaxInt(pDX, m_height, 0, 1000);
DDX_Text(pDX, IDC_WIDTH, m_width);
DDV_MinMaxInt(pDX, m_width, 0, 2000);
DDX_Text(pDX, IDC_PMU, m_pxCross);
DDV_MinMaxDouble(pDX, m_pxCross, 0.4, 0.99);
DDX_Text(pDX, IDC_PXC, m_pMutation);
DDV_MinMaxDouble(pDX, m_pMutation, 1.e-004, 0.1);
DDX_Text(pDX, IDC_FILEPATH, m_FilePath);
DDX_Text(pDX, IDC_PMU2, m_GenS);
DDV_MinMaxInt(pDX, m_GenS, 10, 10000);
//}}AFX_DATA_MAP
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
//{{AFX_MSG_MAP(CMyDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_OPENFILE, OnOpenfile)
ON_BN_CLICKED(IDM_DRAWFIRST, OnDrawfirst)
ON_BN_CLICKED(IDM_DRAWBEST, OnProcess)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlg message handlers
BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
m_flag0=FALSE;
m_flag1=FALSE;
begin_place=0;
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMyDlg::OnPaint()
{ if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
if(m_flag0)
OnDrawfirst();
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMyDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CMyDlg::OnOpenfile()
{
// TODO: Add your control notification handler code here
CFileDialog MyFileDialog(TRUE,"txt","source.txt",NULL,"文本文件(*.txt)|*.txt|*.dat");
if(MyFileDialog.DoModal()==IDOK)
{
m_FilePath=MyFileDialog.GetPathName();
InitData(MyFileDialog.GetPathName());
}
((CButton*)GetDlgItem(IDM_DRAWBEST))->EnableWindow(TRUE);//
UpdateData(FALSE);
}
void CMyDlg::InitData(CString filename)
{
CString str;
DataFile.Open(filename,CFile::modeRead);
int i=0;
DataFile.ReadString(str);
while(str!=_T(""))
{
str.TrimLeft(' ');
Data[i][0]=atoi(str.Left(str.Find(' ')));
str=str.Right(str.GetLength()-str.Find(' ')-1);
Data[i][1]=atoi(str);
DataFile.ReadString(str);
i++;
}
m_Snumber=i;
DataFile.Close();
for (i=0;i0];
rect[i].w=Data[i][1];
recto[i]=rect[i];
}
for(i=0;i//长宽统一
{ int a,b;
a=rect[i].l;
b=rect[i].w;
rect[i].l=max(a,b);
rect[i].w=min(a,b);
}
/* int max0,max1,max2,max3;
for (i=9;i>0;i--)
{
for (int j=9;j>9-i;j--)
{
if (rect[j][0]>rect[j-1][0])//按面积预先排列
{
max0=rect[j][0];
rect[j][0]=rect[j-1][0];
rect[j-1][0]=max0;
max1=rect[j][1];
rect[j][1]=rect[j-1][1];
rect[j-1][1]=max1;
max2=rect[j][2];
rect[j][2]=rect[j-1][2];
rect[j-1][2]=max2;
max3=rect[j][3];
rect[j][3]=rect[j-1][3];
rect[j-1][3]=max3;
}
}
}
*/
empty[0].l=m_width;
empty[0].w=m_height;
empty[0].x=0;
empty[0].y=m_height;
}
void CMyDlg::OnDrawfirst()
{
UpdateData(TRUE);
for(int i=0;i0].l=m_width;
empty[0].w=m_height;
empty[0].x=0;
empty[0].y=m_height;
for(i=1;i1;i++)
{
empty[i].l=2000;
empty[i].w=2000;
empty[i].x=2000;
empty[i].y=2000;
}
CClientDC dc(this);
if(m_height!=0 &&m_width!=0)
{
CRect r;
GetClientRect(r);
r.left=r.left+21;
r.right=r.right-130;
r.bottom=r.bottom-18;
r.top=r.bottom-m_height*r.Width()/m_width;
dc.Rectangle (&r);
}
else
MessageBox("长宽不能为0!");
m_flag0=TRUE;
}
void CMyDlg::OnDrawbest()
{
int num=0;
int flag1;//横竖
while (num!=m_Snumber)
{
for(int i=0;i1;i++ )
{
flag1=CalcuRate(empty[i],rect[num]);
if(3==flag1)
if(1==flag1)
{
rect[num].x=empty[i].x+rect[num].w;
rect[num].y=empty[i].y-rect[num].l;
empty[num+1].l=empty[i].l-rect[num].w;
empty[num+1].w=empty[i].w;
empty[num+1].x=empty[i].x+rect[num].w;
empty[num+1].y=empty[i].y;
empty[i].l=rect[num].w;
empty[i].w=empty[i].w-rect[num].l;
empty[i].y=empty[i].y-rect[num].l;
OrderEmpty();
rect[num].flag=flag1;
break ;
}
if(0==flag1)
{
rect[num].x=empty[i].x+rect[num].l;
rect[num].y=empty[i].y-rect[num].w;
empty[num+1].l=empty[i].l-rect[num].l;
empty[num+1].w=empty[i].w;
empty[num+1].x=empty[i].x+rect[num].l;
empty[num+1].y=empty[i].y;
empty[i].l=rect[num].l;
empty[i].w=empty[i].w-rect[num].w;
empty[i].y=empty[i].y-rect[num].w;
OrderEmpty();
rect[num].flag=flag1;
break ;
}
}
num++;
}
DrawBest();
}
void CMyDlg::DrawBest()
{
CClientDC dc(this);
for (int i=0;iif(rect[i].l!=0 && rect[i].w!=0)
{
COLORREF color;
color=RGB((int)1.00*i*250/m_Snumber+20,(int)1.00*i*255/2*m_Snumber+50,(int)1.00*i*255/3*m_Snumber+50);
CRect r;
if (rect[i].flag==0)
{
r.left=Transformx(rect[i].x-rect[i].l);
r.top=Transformy(rect[i].y+rect[i].w);
r.right=Transformx(rect[i].x);
r.bottom=Transformy(rect[i].y);
dc.Rectangle(r);
dc.FillSolidRect(r.left+1,r.top+1,r.Width()-2,r.Height()-2,color);
}
if (rect[i].flag==1)
{
r.left=Transformx(rect[i].x-rect[i].w);
r.top=Transformy(rect[i].y+rect[i].l);
r.right=Transformx(rect[i].x);
r.bottom=Transformy(rect[i].y);
dc.Rectangle(r);
dc.FillSolidRect(r.left+1,r.top+1,r.Width()-2,r.Height()-2,color);
}
}
}
}
int CMyDlg::CalcuRate(RectBB empty,RectAA rect)
{
if((empty.w>=rect.l && empty.l>=rect.w) && (empty.w>=rect.w && empty.l>=rect.l))
return 1;
if((empty.w>=rect.l && empty.l>=rect.w) && (empty.lreturn 1;
if((empty.w>=rect.w && empty.l>=rect.l) && (empty.lreturn 0;
if((empty.lreturn 3;
}
int CMyDlg::Transformx(int x)
{ int xx;
CRect r;
GetClientRect(r);
r.left=r.left+21;
r.right=r.right-130;
r.bottom=r.bottom-18;
r.top=r.bottom-m_height*r.Width()/m_width;
xx=int(r.left+x*r.Width()/m_width+0.5);
return xx;
}
int CMyDlg::Transformy(int y)
{
int yy;
CRect r;
GetClientRect(r);
r.left=r.left+21;
r.right=r.right-130;
r.bottom=r.bottom-18;
r.top=r.bottom-m_height*r.Width()/m_width;
yy=int(r.bottom-y*r.Width()/m_width+0.5);
return yy;
}
void CMyDlg::OrderEmpty()
{ RectBB mid;
for (int i=m_Snumber;i>0;i--)
{
for (int j=m_Snumber;j>m_Snumber-i;j--)
{
if (abs(empty[j].x-0)1].x-0))
{
mid=empty[j];
empty[j]=empty[j-1];
empty[j-1]=mid;
}
}
}
}
//基因换位
void CMyDlg::swap(int *a, int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
//随机数
int CMyDlg::IntGenerate()
{
int RANGE_MIN=0;
int RANGE_MAX=m_Snumber;
int randpop=int (rand()%1000/1000.0)*RANGE_MAX;
return randpop;
}
//选择种群
void CMyDlg::SecletMember()
{
int *a=new int[m_Snumber];
int x1,x2,j=0,temp1;
for(int i=0; ifor(j=0;j<100;j++)
{
for(i=0;i<100;i++) //100次交换足以产生各种结果了
{
x1=IntGenerate();
x2=IntGenerate();
if (x1!=x2)
{
temp1=a[x1];
a[x1]=a[x2];
a[x2]=temp1;
}
}
for(i=0;ifor(i=0;i100].gene[i]=i;
population[100].fitness=Valuecount(population[100]);
}
//适应性
void CMyDlg::evaluate()
{
int j=0;
for(int i=0;i<(500000000/m_GenS);i++)//1000控制界面速度
{ if(0==i%(5000000/m_GenS))
{
population[j].fitness=Valuecount(population[j]);
j++;
}
}
}
//评价
double CMyDlg::Valuecount(GenoType node)
{
int rl=rect[0].x;
for (int i=0;ifor ( i=1;iif(rect[i].x>=rl)
rl=rect[i].x;
}
return 1.000*rl/m_width;
}
//选种
void CMyDlg::KeepTheBest()
{
int mem,i;
curbest=0;
for(mem=1;mem<100;mem++)
if(population[mem].fitnessif(population[curbest].fitness100].fitness)
population[100]=population[curbest];//获得当前世代里的最好基因序列,并保存在当前世代的最后一个染色体中
}
//传代
void CMyDlg::elitist()
{
int i;
double best,worst;
int best_mem=0,worst_mem=0;
best=population[0].fitness;
worst=population[0].fitness;
for(i=1;i<100;i++)
{
if(population[i].fitness<=best)
{
best=population[i].fitness;
best_mem=i;
}
if(population[i].fitness>=worst)
{
worst=population[i].fitness;
worst_mem=i;
}
}
if(best<=population[100].fitness) //后一个体不如前一个体,就不要动前一世代
{
for(i=0;i100].gene[i]=population[best_mem].gene[i];
population[100].fitness=best;
}
else //否则
{
for(i=0;i100].gene[i];
population[worst_mem].fitness=population[100].fitness;
}
}
void CMyDlg::SecletBetter()
{
int mem,i;
double sum=0;
double x[100];
double p;
int p1,p2;
for(mem=0;mem<100;mem++)
sum+=population[mem].fitness;
for(mem=0;mem<100;mem++)
x[mem]=sum-population[mem].fitness;
sum=0;
for(mem=0;mem<100;mem++)
sum+=x[mem];
for(mem=0;mem<100;mem++) //以对总体的贡献来确定其在种群中的相对适应度
population[mem].rfitness=(double)x[mem]/sum;
population[0].cfitness=population[0].rfitness;
for(mem=1;mem<100;mem++)
{
population[mem].cfitness=population[mem-1].cfitness+population[mem].rfitness;
}
for(i=0;i<100;i++)
{
p=rand()%1000/1000.0;
if(population[0].cfitness>p) //适者生存
newpopulation[i]=population[0];
else
{
for(int j=0;j<100;j++)//弱肉强食
if(p>=population[j].cfitness && p1].cfitness)
newpopulation[i]=population[j+1];
}
}
for(i=0;i<100;i++)
population[i]=newpopulation[i];
/* for(i=0;i<100;i++) //随机PK
{
p1=(rand()%1000/1000.0)*100;
p2=(rand()%1000/1000.0)*100;
if(p1!=p2)
{
if (population[p1].rfitness>population[p2].rfitness)
{
population[p2]=population[p1];
}
else
population[p1]=population[p2];
}
}
*/
}
void CMyDlg::crossover()//交叉
{
int i,j;
int min,max,flag;
double x;
for(i=0;i1000/1000.0;
if(x0;max=0;
while(min==0)
min=IntGenerate();
while(max==0)
max=IntGenerate();
if(maxfor(j=min;j<=(max+min)/2;j++)//从min到max倒序
{
swap(&population[i].gene[j],&population[i].gene[flag]);
flag=flag-1;
}
}
}
}
void CMyDlg::mutate()//变异
{
int i;
int x1,x2;
double x;
for(i=0;i1000/1000.0;
if(x0;x2=0;
while(x1==0)
x1=IntGenerate();
while(x2==0)
x2=IntGenerate();
swap(&population[i].gene[x1],&population[i].gene[x2]);
}
}
}
//优化函数
void CMyDlg::OnProcess()
{
UpdateData(TRUE);
m_flag1=TRUE;
generation=0;
srand(time( NULL ) ); //取系统时间为随机种子
SecletMember();
evaluate();
KeepTheBest();
SetTimer(1,10,NULL);
}
void CMyDlg::OnTimer(UINT nIDEvent)
{
if(generationelse
{
KillTimer(TRUE);
int sum=0;
for (int i=0;i//根据面积计算利用率
}
CString str;
str.Format("板材利用率:%.2f%%",100*sum/(Valuecount(population[100])*m_height*m_width));
MessageBox(str);
}
CDialog::OnTimer(nIDEvent);
}
```)
######
```c++
--------------------Configuration: 遗传算法Dlg - Win32 Debug--------------------
Linking...
遗传算法.obj : warning LNK4044: unrecognized option "manifestdependency:type='win32' name='Microsoft.VC90.DebugCRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"; ignored
遗传算法.obj : warning LNK4044: unrecognized option "manifestdependency:type='win32' name='Microsoft.VC90.DebugMFC' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"; ignored
GeneticDlg.obj : error LNK2005: "public: __thiscall CAboutDlg::CAboutDlg(void)" (??0CAboutDlg@@QAE@XZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: virtual void __thiscall CAboutDlg::DoDataExchange(class CDataExchange *)" (?DoDataExchange@CAboutDlg@@MAEXPAVCDataExchange@@@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: virtual struct AFX_MSGMAP const * __thiscall CAboutDlg::GetMessageMap(void)const " (?GetMessageMap@CAboutDlg@@MBEPBUAFX_MSGMAP@@XZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: __thiscall CMyDlg::CMyDlg(class CWnd *)" (??0CMyDlg@@QAE@PAVCWnd@@@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: virtual void __thiscall CMyDlg::DoDataExchange(class CDataExchange *)" (?DoDataExchange@CMyDlg@@MAEXPAVCDataExchange@@@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: virtual struct AFX_MSGMAP const * __thiscall CMyDlg::GetMessageMap(void)const " (?GetMessageMap@CMyDlg@@MBEPBUAFX_MSGMAP@@XZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: virtual int __thiscall CMyDlg::OnInitDialog(void)" (?OnInitDialog@CMyDlg@@MAEHXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: void __thiscall CMyDlg::OnSysCommand(unsigned int,long)" (?OnSysCommand@CMyDlg@@IAEXIJ@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: void __thiscall CMyDlg::OnPaint(void)" (?OnPaint@CMyDlg@@IAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: struct HICON__ * __thiscall CMyDlg::OnQueryDragIcon(void)" (?OnQueryDragIcon@CMyDlg@@IAEPAUHICON__@@XZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: void __thiscall CMyDlg::OnOpenfile(void)" (?OnOpenfile@CMyDlg@@IAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::InitData(class CString)" (?InitData@CMyDlg@@QAEXVCString@@@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: void __thiscall CMyDlg::OnDrawfirst(void)" (?OnDrawfirst@CMyDlg@@IAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::OnDrawbest(void)" (?OnDrawbest@CMyDlg@@QAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::DrawBest(void)" (?DrawBest@CMyDlg@@QAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: int __thiscall CMyDlg::CalcuRate(struct CMyDlg::RectBB,struct CMyDlg::RectAA)" (?CalcuRate@CMyDlg@@QAEHURectBB@1@URectAA@1@@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: int __thiscall CMyDlg::Transformx(int)" (?Transformx@CMyDlg@@QAEHH@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: int __thiscall CMyDlg::Transformy(int)" (?Transformy@CMyDlg@@QAEHH@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::OrderEmpty(void)" (?OrderEmpty@CMyDlg@@QAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::swap(int *,int *)" (?swap@CMyDlg@@QAEXPAH0@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: int __thiscall CMyDlg::IntGenerate(void)" (?IntGenerate@CMyDlg@@QAEHXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::SecletMember(void)" (?SecletMember@CMyDlg@@QAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::evaluate(void)" (?evaluate@CMyDlg@@QAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: double __thiscall CMyDlg::Valuecount(struct CMyDlg::GenoType)" (?Valuecount@CMyDlg@@QAENUGenoType@1@@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::KeepTheBest(void)" (?KeepTheBest@CMyDlg@@QAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::elitist(void)" (?elitist@CMyDlg@@QAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::SecletBetter(void)" (?SecletBetter@CMyDlg@@QAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::crossover(void)" (?crossover@CMyDlg@@QAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "public: void __thiscall CMyDlg::mutate(void)" (?mutate@CMyDlg@@QAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: void __thiscall CMyDlg::OnProcess(void)" (?OnProcess@CMyDlg@@IAEXXZ) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: void __thiscall CMyDlg::OnTimer(unsigned int)" (?OnTimer@CMyDlg@@IAEXI@Z) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: static struct AFX_MSGMAP const CMyDlg::messageMap" (?messageMap@CMyDlg@@1UAFX_MSGMAP@@B) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "private: static struct AFX_MSGMAP_ENTRY const * const CMyDlg::_messageEntries" (?_messageEntries@CMyDlg@@0QBUAFX_MSGMAP_ENTRY@@B) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "protected: static struct AFX_MSGMAP const CAboutDlg::messageMap" (?messageMap@CAboutDlg@@1UAFX_MSGMAP@@B) already defined in 遗传算法Dlg.obj
GeneticDlg.obj : error LNK2005: "private: static struct AFX_MSGMAP_ENTRY const * const CAboutDlg::_messageEntries" (?_messageEntries@CAboutDlg@@0QBUAFX_MSGMAP_ENTRY@@B) already defined in 遗传算法Dlg.obj
nafxcwd.lib(wincore.obj) : warning LNK4078: multiple ".CRT" sections found with different attributes (C0300040)
LINK : fatal error LNK1104: cannot open file "mfc90d.lib"
执行 link.exe 时出错.
遗传算法Dlg.exe - 1 error(s), 0 warning(s)