/** She works!!! Change POINT_NUM, DEG,CENTER_POINT Press ctrl-c to shrink the window. ***/ #include #include #include #include #include #include //#include #define TRYS 1000 #define MAX_DEPTH 100 #define DEG 5 /*Actualy degree-1*/ #define POINT_NUM 2 #define SAMPLE_SIZE 50 #define ITERATIONS 100000 #define SPECTRAL 1 #define CENTER_POINT 0 /*The Precision*/ #define PREC 512 //The co-efficents for the polynomials mpf_t RAND_COEFS[SAMPLE_SIZE][DEG]; //The evaluation of their integrals mpf_t RAND_AVES[SAMPLE_SIZE]; //fittness mpf_t FIT; mpf_t BEST_FIT; //New element mpf_t NEW_ELT[POINT_NUM]; mpf_t BEST[POINT_NUM]; mpf_t VAL,TEMP1,TEMP2,TEMP3; mpf_t WINDOW_SIZE; void cnt(int sig) { mpf_div_ui(WINDOW_SIZE,WINDOW_SIZE,2); printf("\n"); mpf_out_str(NULL,10,10,WINDOW_SIZE); printf("\n"); } //Get the fittest member of SWARM_POP, swap him to SWARM_POP[0] int findFittest() { int i; if(mpf_cmp(FIT,BEST_FIT)<0) { mpf_swap(FIT,BEST_FIT); for(i=0;i0) mpf_set_d(NEW_ELT[j],.9999999); } } //Evaluate each member of the population to see how close they were to the //actual answers void evalSingle() { int i,j,l; int realPointNum; mpf_set_d(FIT,0.0); for(i=0;i