f2.c

来自「压缩包内内容有:《遗传算法——理论、应用与软件实现》中所附源程序C或C++代码文」· C语言 代码 · 共 18 行

C
18
字号
/************************************************  file f2.c  ****/

double eval(str, length, vect, genes)
char str[];	/* string representation			*/
int length;	/* length of bit string				*/
double vect[];	/* floating point representation		*/
int genes;	/* number of elements in vect			*/
{
	double ans;

	ans = (vect[0]*vect[0] - vect[1]);
	ans *= ans;
	ans = 100.0*ans + (1.0 - vect[0])*(1.0 - vect[0]);
	return (ans);
}

/** end of file **/

⌨️ 快捷键说明

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