C   29

type.h

Guest on 29th June 2022 08:03:15 AM

  1.  
  2.  
  3. typedef struct {
  4.   int *chrom;   /* the chromosome */
  5.  
  6.   double x;     /* Placeholder for a decoded chromosome value */
  7.  
  8.   double fitness;  
  9.  
  10.   int parent1;
  11.   int parent2;
  12.  
  13. } INDIVIDUAL;
  14.  
  15. typedef INDIVIDUAL *IPTR;
  16.  
  17. typedef struct {
  18.  
  19.   IPTR op;       /* arrays of individuals form an evolving population*/
  20.   IPTR np;
  21.  
  22.   int    lchrom;  /* chromosome length */
  23.   int    gen;     /* current generation */
  24.  
  25.   double sumFitness; /* statistics parameters for selection and tracking*/
  26.   double max;        /* progress */
  27.   double avg;
  28.   double min;
  29.  
  30.   double pCross;        /* probability of Xover */
  31.   double pMut;          /* probability of Mutation */
  32.   double randomseed;  
  33.  
  34.  
  35.   double highestEverFitness;
  36.   int    highestEverGen;
  37.   int    highestEverIndex;
  38.  
  39.   int    maxi; /* index of best individual in current population*/
  40.   int    mini; /* index of worst individual in current population*/
  41.  
  42.   int    maxGen; /* when to stop */
  43.   int    popSize;/* population size */
  44.  
  45.   char  *ofile;  /* output File name */
  46. } POPULATION;

Raw Paste


Login or Register to edit or fork this paste. It's free.