1 /*Routines for storing population data into files*/2 3# include <stdio.h>4# include <stdlib.h>5# include <math.h>6 7# include"global.h"8# include"rand.h"9 Ten /*Function to print the information of a population in a file*/ One voidReport_pop (population *pop, FILE *FPT) A { - intI, J, K; - for(i=0; i<popsize; i++) the { - for(j=0; j<nobj; J + +) - { -fprintf (FPT,"%e\t",pop->ind[i].obj[j]); + } - if(ncon!=0) + { A for(j=0; j<ncon; J + +) at { -fprintf (FPT,"%e\t",pop->ind[i].constr[j]); - } - } - if(nreal!=0) - { in for(j=0; j<nreal; J + +) - { tofprintf (FPT,"%e\t",pop->ind[i].xreal[j]); + } - } the if(nbin!=0) * { $ for(j=0; j<nbin; J + +)Panax Notoginseng { - for(k=0; k<nbits[j]; k++) the { +fprintf (FPT,"%d\t",pop->ind[i].gene[j][k]); A } the } + } -fprintf (FPT,"%e\t",pop->ind[i].constr_violation); $fprintf (FPT,"%d\t",pop->Ind[i].rank); $fprintf (FPT,"%e\n",pop->ind[i].crowd_dist); - } - return; the } - Wuyi /*Function to print the information of feasible and non-dominated population in a file*/ the voidReport_feasible (population *pop, FILE *FPT) - { Wu intI, J, K; - for(i=0; i<popsize; i++) About { $ if(Pop->ind[i].constr_violation = =0.0&& pop->ind[i].rank==1) - { - for(j=0; j<nobj; J + +) - { Afprintf (FPT,"%e\t",pop->ind[i].obj[j]); + } the if(ncon!=0) - { $ for(j=0; j<ncon; J + +) the { thefprintf (FPT,"%e\t",pop->ind[i].constr[j]); the } the } - if(nreal!=0) in { the for(j=0; j<nreal; J + +) the { Aboutfprintf (FPT,"%e\t",pop->ind[i].xreal[j]); the } the } the if(nbin!=0) + { - for(j=0; j<nbin; J + +) the {Bayi for(k=0; k<nbits[j]; k++) the { thefprintf (FPT,"%d\t",pop->ind[i].gene[j][k]); - } - } the } thefprintf (FPT,"%e\t",pop->ind[i].constr_violation); thefprintf (FPT,"%d\t",pop->Ind[i].rank); thefprintf (FPT,"%e\n",pop->ind[i].crowd_dist); - } the } the return; the}
Report_pop the target function value of all the individuals in the population, limiting the condition value, and printing the encoded value.
Report_pop the object function value of the individual in the population of the non-dominant entity and limiting the sum of the conditions to 0 (constr_violation = = 0.0) , limiting the condition value, The encoded value is printed out.
Multi-Objective genetic algorithm------NSGA-II (partial source parsing) Status report print report.c