double MyHCJob19::basic_func(int func_no, double *x,int length) {
	double result = 0.0;
	switch(func_no) {
		case 0:
		case 1:
			result = ackley(x,length);
			break;
		case 2:
		case 3:
			result = rastrigin(x,length);
			break;
		case 4:
		case 5:
			result = sphere(x,length);
			break;
		case 6:
		case 7:
			result = weierstrass(x,length);
			break;
		case 8:
		case 9:
			result = griewank(x,length);
			break;
		default:
			printf("func_no is out of range.");
			exit(-1);
	}
	return (result);
}
コード例 #2
0
// Function body
double F11_shifted_rotated_weierstrass::f(double *x,int length) {

	double result = 0.0;

	shift(m_z, x, m_o,length);
	xA(m_zM, m_z, m_matrix,length);

	result = weierstrass(m_zM,length);

	result += m_bias;

	return (result);
}
コード例 #3
0
ファイル: benchmark.cpp プロジェクト: wkoder/CINVESTAV
// Shifted rotated Weierstrass function: F11 from [43]
double f19(double *x) {
	double f = 0;
	double a = 0.5;
	double b = 3.0;
	double z[n];
	double tmp[n];
	int kmax = 20;
	
	subtractVector(x, O, tmp);
	multiplyMatrix(tmp, A, z);
	f = weierstrass(z);
	for (int k = 0; k <= kmax; k++)
		f -= n * pow(a, k) * cos(2 * M_PI * pow(b, k) * 0.5);
	
	return f;
}
コード例 #4
0
double MyHCJob24::basic_func(int func_no, double *x,int length) {
	double result = 0.0;
	// This part is according to Matlab reference code
	switch(func_no) {
		case 0:
			result = weierstrass(x,length);
			break;
		case 1:
			result = EScafferF6(x,length);
			break;
		case 2:
			result = F8F2(x,length);
			break;
		case 3:
			result = ackley(x,length);
			break;
		case 4:
			result = rastrigin(x,length);
			break;
		case 5:
			result = griewank(x,length);
			break;
		case 6:
			result = EScafferF6NonCont(x,length);
			break;
		case 7:
			result = rastriginNonCont(x,length);
			break;
		case 8:
			result = elliptic(x,length);
			break;
		case 9:
			result = sphere_noise(x,length);
			break;
		default:
			puts("func_no is out of range.");
			exit(-1);
	}
	return (result);
}