├── KOA.m ├── main.m ├── cec14_func.cpp ├── cec17_func.cpp ├── cec20_func.cpp ├── cec14_func.mexw32 ├── cec14_func.mexw64 ├── cec17_func.mexw64 ├── cec20_func.mexw64 ├── cec22_func.mexw64 ├── initialization.m ├── cec22_test_func.mexw64 ├── Get_Functions_detailsCEC.m └── cec22_func.cpp /KOA.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/KOA.m -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/main.m -------------------------------------------------------------------------------- /cec14_func.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/cec14_func.cpp -------------------------------------------------------------------------------- /cec17_func.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/cec17_func.cpp -------------------------------------------------------------------------------- /cec20_func.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/cec20_func.cpp -------------------------------------------------------------------------------- /cec14_func.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/cec14_func.mexw32 -------------------------------------------------------------------------------- /cec14_func.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/cec14_func.mexw64 -------------------------------------------------------------------------------- /cec17_func.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/cec17_func.mexw64 -------------------------------------------------------------------------------- /cec20_func.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/cec20_func.mexw64 -------------------------------------------------------------------------------- /cec22_func.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/cec22_func.mexw64 -------------------------------------------------------------------------------- /initialization.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/initialization.m -------------------------------------------------------------------------------- /cec22_test_func.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/cec22_test_func.mexw64 -------------------------------------------------------------------------------- /Get_Functions_detailsCEC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redamohamed8/Kepler-Optimization-Algorithm/HEAD/Get_Functions_detailsCEC.m -------------------------------------------------------------------------------- /cec22_func.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | CEC22 Test Function Suite for Single Objective Bound Constrained Numerical Optimization 3 | 4 | 5 | 1. Run the following command in Matlab window: 6 | mex cec22_test_func.cpp -DWINDOWS 7 | 2. Then you can use the test functions as the following example: 8 | f = cec22_func(x,func_num); 9 | Here x is a D*pop_size matrix. 10 | */ 11 | 12 | // #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | double *OShift,*M,*y,*z,*x_bound; 19 | int ini_flag=0,n_flag,func_flag,*SS; 20 | 21 | // #include 22 | // #include 23 | // #include 24 | // #include 25 | 26 | #define INF 1.0e99 27 | #define EPS 1.0e-14 28 | #define E 2.7182818284590452353602874713526625 29 | #define PI 3.1415926535897932384626433832795029 30 | 31 | void ackley_func (double *, double *, int , double *,double *, int, int); /* Ackley's */ 32 | void bent_cigar_func(double *, double *, int , double *,double *, int, int); /* Discus */ 33 | void discus_func(double *, double *, int , double *,double *, int, int); /* Bent_Cigar */ 34 | void ellips_func(double *, double *, int , double *,double *, int, int); /* Ellipsoidal */ 35 | void escaffer6_func (double *, double *, int , double *,double *, int, int); /* Expanded Scaffer¡¯s F6 */ 36 | void griewank_func (double *, double *, int , double *,double *, int, int); /* Griewank's */ 37 | void grie_rosen_func (double *, double *, int , double *,double *, int, int); /* Griewank-Rosenbrock */ 38 | void happycat_func (double *, double *, int , double *,double *, int, int); /* HappyCat */ 39 | void hgbat_func (double *, double *, int , double *,double *, int, int); /* HGBat */ 40 | void rosenbrock_func (double *, double *, int , double *,double *, int, int); /* Rosenbrock's */ 41 | void rastrigin_func (double *, double *, int , double *,double *, int, int); /* Rastrigin's */ 42 | void schwefel_func (double *, double *, int , double *,double *, int, int); /* Schwefel's */ 43 | void schaffer_F7_func (double *, double *, int , double *,double *, int, int); /* Schwefel's F7 */ 44 | void step_rastrigin_func (double *, double *, int , double *,double *, int, int); /* Noncontinuous Rastrigin's */ 45 | void levy_func(double *, double *, int , double *,double *, int, int); /* Levy */ 46 | void zakharov_func(double *, double *, int , double *,double *, int, int); /* ZAKHAROV */ 47 | void katsuura_func (double *, double *, int , double *,double *, int, int); /* Katsuura */ 48 | 49 | 50 | 51 | void hf02 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 2 */ 52 | void hf06 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 6 */ 53 | void hf10 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 10 */ 54 | 55 | 56 | void cf01 (double *, double *, int , double *,double *, int); /* Composition Function 1 */ 57 | void cf02 (double *, double *, int , double *,double *, int); /* Composition Function 2 */ 58 | void cf06 (double *, double *, int , double *,double *, int); /* Composition Function 6 */ 59 | void cf07 (double *, double *, int , double *,double *, int); /* Composition Function 7 */ 60 | 61 | 62 | 63 | void shiftfunc (double*,double*,int,double*); 64 | void rotatefunc (double*,double*,int, double*); 65 | void sr_func (double *, double *, int, double*, double*, double, int, int); /* shift and rotate */ 66 | void asyfunc (double *, double *x, int, double); 67 | void oszfunc (double *, double *, int); 68 | void cf_cal(double *, double *, int, double *,double *,double *,double *,int); 69 | 70 | void cec22_test_func(double *, double *,int,int,int); 71 | 72 | void mexFunction (int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[]) 73 | { 74 | int m, n,func_num; 75 | double *f, *x; 76 | if ((nrhs < 2) || (nlhs < 1)) 77 | { 78 | mexPrintf ("usage: f = cec22_func(x, func_num);\n"); 79 | mexErrMsgTxt ("example: f= cec22_func([3.3253000e+000, -1.2835000e+000]', 1);"); 80 | } 81 | n = mxGetM (prhs[0]); 82 | if (!(n==2||n==10||n==20)) 83 | { 84 | mexPrintf ("usage: f = cec22_func(x, func_num);\n"); 85 | mexErrMsgTxt ("Error: Test functions are only defined for D=2,10,20."); 86 | } 87 | m = mxGetN (prhs[0]); 88 | x = mxGetPr (prhs[0]); 89 | func_num= (int)*mxGetPr (prhs[1]); 90 | if (func_num>12) 91 | { 92 | mexPrintf ("usage: f = cec22_func(x, func_num);\n"); 93 | mexErrMsgTxt ("Error: There are only 10 test functions in this test suite!"); 94 | } 95 | 96 | plhs[0] = mxCreateDoubleMatrix (1, m, mxREAL); 97 | f = mxGetPr (plhs[0]); 98 | cec22_test_func(&x[0], &f[0], n,m,func_num); 99 | } 100 | 101 | 102 | void cec22_test_func(double *x, double *f, int nx, int mx,int func_num) 103 | { 104 | 105 | int cf_num=12,i,j; 106 | if (func_num<1||func_num>12) 107 | { 108 | printf("\nError: Test function %d is not defined.\n", func_num); 109 | } 110 | if (ini_flag==1) 111 | { 112 | if ((n_flag!=nx)||(func_flag!=func_num)) 113 | { 114 | ini_flag=0; 115 | } 116 | } 117 | 118 | if (ini_flag==0) 119 | { 120 | FILE *fpt; 121 | char FileName[256]; 122 | free(M); 123 | free(OShift); 124 | free(y); 125 | free(z); 126 | free(x_bound); 127 | y=(double *)malloc(sizeof(double) * nx); 128 | z=(double *)malloc(sizeof(double) * nx); 129 | x_bound=(double *)malloc(sizeof(double) * nx); 130 | for (i=0; i=6&&func_num<=8) 217 | { 218 | sprintf(FileName, "input_data22/shuffle_data_%d_D%d.txt", func_num, nx); 219 | fpt = fopen(FileName,"r"); 220 | if (fpt==NULL) 221 | { 222 | printf("\n Error: Cannot open shuffle_data_%d_D%d.txt for reading \n", func_num, nx); 223 | } 224 | SS=(int *)malloc(nx*sizeof(int)); 225 | if (SS==NULL) 226 | printf("\nError: there is insufficient memory available!\n"); 227 | for(i=0;i500) 427 | { 428 | f[0]-=(500.0-fmod(z[i],500))*sin(pow(500.0-fmod(z[i],500),0.5)); 429 | tmp=(z[i]-500.0)/100; 430 | f[0]+= tmp*tmp/nx; 431 | } 432 | else if (z[i]<-500) 433 | { 434 | f[0]-=(-500.0+fmod(fabs(z[i]),500))*sin(pow(500.0-fmod(fabs(z[i]),500),0.5)); 435 | tmp=(z[i]+500.0)/100; 436 | f[0]+= tmp*tmp/nx; 437 | } 438 | else 439 | f[0]-=z[i]*sin(pow(fabs(z[i]),0.5)); 440 | } 441 | f[0] +=4.189828872724338e+002*nx; 442 | 443 | } 444 | 445 | 446 | 447 | void grie_rosen_func (double *x, double *f, int nx, double *Os,double *Mr,int s_flag, int r_flag) /* Griewank-Rosenbrock */ 448 | { 449 | int i; 450 | double temp,tmp1,tmp2; 451 | f[0]=0.0; 452 | 453 | sr_func (x, z, nx, Os, Mr, 5.0/100.0, s_flag, r_flag); /* shift and rotate */ 454 | 455 | z[0] += 1.0;//shift to orgin 456 | for (i=0; i0.5) 555 | y[i]=Os[i]+floor(2*(y[i]-Os[i])+0.5)/2; 556 | } 557 | 558 | sr_func (x, z, nx, Os, Mr, 5.12/100.0, s_flag, r_flag); /* shift and rotate */ 559 | 560 | for (i=0; i0) 937 | xasy[i]=pow(x[i],1.0+beta*i/(nx-1)*pow(x[i],0.5)); 938 | } 939 | } 940 | 941 | void oszfunc (double *x, double *xosz, int nx) 942 | { 943 | int i,sx; 944 | double c1,c2,xx; 945 | for (i=0; i0) 952 | { 953 | c1=10; 954 | c2=7.9; 955 | } 956 | else 957 | { 958 | c1=5.5; 959 | c2=3.1; 960 | } 961 | if (x[i]>0) 962 | sx=1; 963 | else if (x[i]==0) 964 | sx=0; 965 | else 966 | sx=-1; 967 | xosz[i]=sx*exp(xx+0.049*(sin(c1*xx)+sin(c2*xx))); 968 | } 969 | else 970 | xosz[i]=x[i]; 971 | } 972 | } 973 | 974 | 975 | void cf_cal(double *x, double *f, int nx, double *Os,double * delta,double * bias,double * fit, int cf_num) 976 | { 977 | int i,j; 978 | double *w; 979 | double w_max=0,w_sum=0; 980 | w=(double *)malloc(cf_num * sizeof(double)); 981 | for (i=0; iw_max) 994 | w_max=w[i]; 995 | } 996 | 997 | for (i=0; i