00001
00002
00003
00004
00005
00006
00007 #include <WINDOWS.H>
00008 #include <stdio.h>
00009 #include <math.h>
00010 #include <malloc.h>
00011
00012
00013 void cec14_test_func(double *, double *,int,int,int);
00014
00015 double *OShift,*M,*y,*z,*x_bound;
00016 int ini_flag=0,n_flag,func_flag,*SS;
00017
00018
00019 void main()
00020 {
00021 int i,j,k,n,m,func_num;
00022 double *f,*x;
00023 FILE *fpt;
00024 char FileName[30];
00025 m=2;
00026 n=10;
00027 x=(double *)malloc(m*n*sizeof(double));
00028 f=(double *)malloc(sizeof(double) * m);
00029 for (i = 0; i < 30; i++)
00030 {
00031 func_num=i+1;
00032 sprintf(FileName, "input_data/shift_data_%d.txt", func_num);
00033 fpt = fopen(FileName,"r");
00034 if (fpt==NULL)
00035 {
00036 printf("\n Error: Cannot open input file for reading \n");
00037 }
00038
00039 if (x==NULL)
00040 printf("\nError: there is insufficient memory available!\n");
00041
00042 for(k=0;k<n;k++)
00043 {
00044 fscanf(fpt,"%Lf",&x[k]);
00045
00046 }
00047
00048 fclose(fpt);
00049
00050 for (j = 0; j < n; j++)
00051 {
00052 x[1*n+j]=0.0;
00053
00054 }
00055
00056
00057 for (k = 0; k < 1; k++)
00058 {
00059 cec14_test_func(x, f, n,m,func_num);
00060 for (j = 0; j < 2; j++)
00061 {
00062 printf(" f%d(x[%d]) = %Lf,",func_num,j+1,f[j]);
00063 }
00064 printf("\n");
00065 }
00066
00067 }
00068 free(x);
00069 free(f);
00070 free(y);
00071 free(z);
00072 free(M);
00073 free(OShift);
00074 free(x_bound);
00075 }
00076
00077