double F7::compute(vector<double> x){ int m = nonSeparableGroupSize; int i; double result; if(Ovector == NULL) { Ovector = createShiftVector(dimension,minX,maxX); Pvector = createPermVector(dimension); } for(i = 0; i < dimension; i++) { anotherz[i] = x[i] - Ovector[i]; } for(i = 0; i < m; i++) { anotherz1[i] = anotherz[Pvector[i]]; } for(i = m; i < dimension; i++) { anotherz2[i - m] = anotherz[Pvector[i]]; } result = schwefel(anotherz1,m) * 1e6 + sphere(anotherz2,dimension - m); return(result); }
double F9::compute(vector<double> x) { int i,k; double result=0.0; if(Ovector==NULL) { Ovector=createShiftVector(dimension,minX,maxX); Pvector=createPermVector(dimension); RotMatrix=createRotMatrix1D(nonSeparableGroupSize); /* * print the multi rotated matrix printf("\n\n\n print the multi rotated matrix\n\n\n"); for (k = 0; k<dimension/(2*nonSeparableGroupSize); k++){ printf("\n matrix %d: \n", k+1); for (i = 0; i<nonSeparableGroupSize*nonSeparableGroupSize; i++){ printf("%1.20E\t", MultiRotMatrix1D[k][i]); } } */ } for(i=0; i<dimension; i++) { anotherz[i]=x[i]-Ovector[i]; } for(k=1; k<=dimension/(2*nonSeparableGroupSize); k++) { result+=rot_elliptic(anotherz,nonSeparableGroupSize,k); } // printf("Rotated Part = %1.20E\n", result); result+=elliptic(anotherz, dimension, 2); return(result); }
double F11::compute(vector<double> x){ int i,k; double result=0.0; if(Ovector==NULL) { Ovector=createShiftVector(dimension,minX,maxX); Pvector=createPermVector(dimension); RotMatrix=createRotMatrix1D(nonSeparableGroupSize); } for(i=0;i<dimension;i++) { anotherz[i]=x[i]-Ovector[i]; } for(k=1;k<=dimension/(2*nonSeparableGroupSize);k++) { result+=rot_ackley(anotherz,nonSeparableGroupSize,k); } // printf("Rot Ackley = %1.16E\n", result); double sepSum = ackley(anotherz,dimension,2); // printf("Separable Ackley = %1.16E\n", sepSum); result+=sepSum; return(result); }
double F5::compute(vector<double> x){ int i; double result = 0.0; if(Ovector == NULL) { Ovector = createShiftVector(dimension,minX,maxX); Pvector = createPermVector(dimension); RotMatrix = createRotMatrix1D(nonSeparableGroupSize); /* Pvector = new int[dimension]; for (int i=0; i<dimension; i++){ Pvector[i] = i; } */ } for(i = 0; i < dimension; i++) { anotherz[i] = x[i] - Ovector[i]; } for(i = 0; i < nonSeparableGroupSize; i++) { anotherz1[i] = anotherz[Pvector[i]]; } for(i = nonSeparableGroupSize; i < dimension; i++) { anotherz2[i - nonSeparableGroupSize] = anotherz[Pvector[i]]; } result = rot_rastrigin(anotherz1,nonSeparableGroupSize) * 1.0e6 + rastrigin( anotherz2,dimension - nonSeparableGroupSize); return(result); }
double F13::compute(vector<double> x){ int i,k; double result=0.0; if(Ovector==NULL) { Ovector=createShiftVector(dimension,minX,maxX-1); Pvector=createPermVector(dimension); } for(i=0;i<dimension;i++) { anotherz[i]=x[i]-Ovector[i]; } for(k=1;k<=dimension/(2*nonSeparableGroupSize);k++) { result+=rosenbrock(anotherz,nonSeparableGroupSize,k); } // printf("Rosenbrock = %1.16E\n", result); // printf("Sphere = %1.16E\n", sphere(anotherz, dimension, 2)); result+=sphere(anotherz, dimension, 2); return(result); }
F17::F17():Benchmarks(){ m_havenextGaussian=0; Ovector = NULL; minX = -100; maxX = 100; ID = 17; Ovector=createShiftVector(dimension,minX,maxX); Pvector=createPermVector(dimension); }
double F8::compute(double* x){ int m = nonSeparableGroupSize; int i; double result; if(Ovector == NULL) { Ovector = createShiftVector(dimension,minX,maxX-1); // printf("\n\n\nO vector\n\n\n"); // for (i = 0; i<dimension; i++){ // printf("%f\t",Ovector[i]); // } Pvector = createPermVector(dimension); //TODO: Neeed to change back to random one **************************************************************************** // Pvector = (int*)malloc(sizeof(int) * dimension); // for (i = 0; i<dimension; i++){ // Pvector[i] = i; // } /* printf("\n\n\nP vector\n\n\n"); for (i = 0; i<dimension; i++){ printf("%d\t",Pvector[i]); } */ } for(i = 0; i < dimension; i++) { anotherz[i] = x[i] - Ovector[i]; } for(i = 0; i < m; i++) { anotherz1[i] = anotherz[Pvector[i]]; } for(i = m; i < dimension; i++) { anotherz2[i - m] = anotherz[Pvector[i]]; } // printf("\n\n\nanotherz1\n\n\n"); // for (i = 0; i<m; i++){ // printf("%f\t",anotherz1[i]); // } result = rosenbrock(anotherz1,m) * 1e6 + sphere(anotherz2,dimension - m); // printf("Rosenbrock Part = %1.16E\n", rosenbrock(anotherz1,m) * 1e6); // printf("Sphere Part = %1.16E\n", sphere(anotherz2,dimension - m)); return(result); }
double F20::compute(vector<double> x){ int i; double result = 0.0; if (Ovector == NULL) { Ovector = createShiftVector(dimension, minX, maxX - 1); } for (i = 0; i < dimension; i++) { anotherz[i] = x[i] - Ovector[i]; } result = rosenbrock(anotherz, dimension); return(result); }
double F19::compute(vector<double> x){ int i; double result; if(Ovector==NULL) { Ovector=createShiftVector(dimension,minX,maxX); } for(i=0;i<dimension;i++) { anotherz[i]=x[i]-Ovector[i]; } result=schwefel(anotherz, dimension); return(result); }
double F12::compute(vector<double> x){ int i,k; double result=0.0; if(Ovector==NULL) { Ovector=createShiftVector(dimension,minX,maxX); Pvector=createPermVector(dimension); } for(i=0;i<dimension;i++) { anotherz[i]=x[i]-Ovector[i]; } for(k=1;k<=dimension/(2*nonSeparableGroupSize);k++) { result+=schwefel(anotherz,nonSeparableGroupSize,k); } result+=sphere(anotherz,dimension, 2); return(result); }
double F10::compute(vector<double> x){ int i,k; double result=0.0; if(Ovector==NULL) { Ovector=createShiftVector(dimension,minX,maxX); Pvector=createPermVector(dimension); MultiRotMatrix1D=createMultiRotateMatrix1D(nonSeparableGroupSize,dimension/(2*nonSeparableGroupSize)); } for(i=0;i<dimension;i++) { anotherz[i]=x[i]-Ovector[i]; } for(k=1;k<=dimension/(2*nonSeparableGroupSize);k++) { result+=rot_rastrigin(anotherz,nonSeparableGroupSize,k); } // printf("Rot Rastrigin = %1.16E\n", result); result+=rastrigin(anotherz, dimension, 2); return(result); }