📄 problem.cpp
字号:
// problem.cpp: implementation of the Cproblem class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "HeredityDemo.h"
#include "problem.h"
#include <iostream.h>
#include <math.h>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Cproblem::Cproblem()
{
}
Cproblem::~Cproblem()
{
}
Cproblem::Cproblem(int ObjectiveNum, int DemensionNum )//构造函数初始化
{
this->m_ObjectiveNum=m_ObjectiveNum;
this->m_DemensionNum=m_DemensionNum;
}
void Cproblem::Calculate(double *ParameterValue, double *ObjectValue)//该函数功能根据参数数值计算目标数值
{
double temp1,temp2;
temp1=pow(*(ParameterValue+0),2)-*(ParameterValue+1);
temp2=pow((1- *(ParameterValue+0)),2);
*ObjectValue=100*pow(temp1,2)+temp2;
}
int Cproblem::GetObjectiveNum()
{
return m_ObjectiveNum;
}
int Cproblem::GetDemensionNum()
{
return m_DemensionNum;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -