#include #include #include #include #include //#include #define SWARM_SIZE 50 /*How fast to converge [0,1]*/ #define CONVERGENCE .5 #define SWARMTIME 1000 #define DEG 3 /*Actualy degree-1*/ #define POINT_NUM 2 #define SAMPLE_SIZE 50 #define ITERATIONS 10000 /*The Precision*/ #define PREC 64 //The co-efficents for the polynomials mpf_t RAND_COEFS[SAMPLE_SIZE][DEG]; //The evaluation of their integrals mpf_t RAND_AVES[SAMPLE_SIZE]; //Running fittness of each swarm member mpf_t SWARM_FIT[SWARM_SIZE]; //Evaluation co-ordinates for each swarm member mpf_t SWARM_POP[SWARM_SIZE][POINT_NUM]; mpf_t VAL,TEMP1,TEMP2,TEMP3; //Get the fittest member of SWARM_POP, swap him to SWARM_POP[0] void findFittest() { int i,index; mpf_set_d(VAL,0.0); index=0; for(i=1;i