1.今天在做优化算法的代码分析时,需要调用CEC13测试函数,按照官方给定
做法,需要输入种群大小矩阵以及func_num,对于后者这个参数实在摸不着头脑,
已百度,仍然无解,求教!急急急!
2.附上代码:
/*
CEC13 Test Function Suite
Jane Jing Liang (email: liangjing@zzu.edu.cn)
14th Feb. 2013
1. Run the following command in Matlab window:
mex cec13_func.cpp -DWINDOWS
2. Then you can use the test functions as the following example:
f = cec13_func(x,func_num);
Here x is a D*pop_size matrix.
*/
#include <WINDOWS.H>
#include <stdio.h>
#include <math.h>
#include <malloc.h>
#include <mex.h>
double *OShift,*M,*y,*z,*x_bound;
int ini_flag=0,n_flag,func_flag;
#define INF 1.0e99
#define EPS 1.0e-14
#define E 2.7182818284590452353602874713526625
#define PI 3.1415926535897932384626433832795029
// Brief:这部分申明了mex文件中需要用到的函数。其中包括:差值函数、
void sphere_func (double *, double *, int , double *,double *, int); /* Sphere */
void ellips_func(double *, double *, int , double *,double *, int); /* Ellipsoidal */
void bent_cigar_func(double *, double *, int , double *,double *, int); /* Discus */
void discus_func(double *, double *, int , double *,double *, int); /* Bent_Cigar */
void dif_powers_func(double *, double *, int , double *,double *, int); /* Different Powers */
void rosenbrock_func (double *, double *, int , double *,double *, int); /* Rosenbrock's */
void schaffer_F7_func (double *, double *, int , double *,double *, int); /* Schwefel's F7 */
void ackley_func (double *, double *, int , double *,double *, int); /* Ackley's */
void rastrigin_func (double *, double *, int , double *,double *, int); /* Rastrigin's */
void step_rastrigin_func (double *, double *, int , double *,double *, int); /* Noncontinuous Rastrigin's */
void weierstrass_func (double *, double *, int , double *,double *, int); /* Weierstrass's */
void griewank_func (double *, double *, int , double *,double *, int); /* Griewank's */
void schwefel_func (double *, double *, int , double *,double *, int); /* Schwefel's */
void katsuura_func (double *, double *, int , double *,double *, int); /* Katsuura */
void bi_rastrigin_func (double *, double *, int , double *,double *, int); /* Lunacek Bi_rastrigin Function */
void grie_rosen_func (double *, double *, int , double *,double *, int); /* Griewank-Rosenbrock */
void escaffer6_func (double *, double *, int , double *,double *, int); /* Expanded Scaffer’s F6 */
void cf01 (double *, double *, int , double *,double *, int); /* Composition Function 1 */
void cf02 (double *, double *, int , double *,double *, int); /* Composition Function 2 */
void cf03 (double *, double *, int , double *,double *, int); /* Composition Function 3 */
void cf04 (double *, double *, int , double *,double *, int); /* Composition Function 4 */
void cf05 (double *, double *, int , double *,double *, int); /* Composition Function 5 */
void cf06 (double *, double *, int , double *,double *, int); /* Composition Function 6 */
void cf07 (double *, double *, int , double *,double *, int); /* Composition Function 7 */
void cf08 (double *, double *, int , double *,double *, int); /* Composition Function 8 */
void shiftfunc (double*,double*,int,double*);
void rotatefunc (double*,double*,int, double*);
void asyfunc (double *, double *x, int, double);
void oszfunc (double *, double *, int);
void cf_cal(double *, double *, int, double *,double *,double *,double *,int);
void test_func(double *, double *,int,int,int);
*******%此处省略大概800行均为函数描写
3.有做这方面的大佬还望不吝赐教,万分感谢!需要代码分享的也可以在楼下评论。