Rev | Line | |
---|
[122] | 1 | #ifndef POPULATION |
---|
| 2 | #define POPULATION |
---|
| 3 | |
---|
| 4 | //#include "Generator.h" |
---|
| 5 | //#include "Evaluator.h" |
---|
| 6 | #include "Graf.h" |
---|
| 7 | #include "Genetic.h" |
---|
| 8 | |
---|
| 9 | /** |
---|
| 10 | * clas implementing a population of chromosomes |
---|
| 11 | */ |
---|
| 12 | class Population |
---|
| 13 | { |
---|
| 14 | public: |
---|
| 15 | /** |
---|
| 16 | * the number of chromosomes |
---|
| 17 | */ |
---|
| 18 | int no_ind; |
---|
| 19 | |
---|
| 20 | /** |
---|
| 21 | * the number of generations the population will evolve |
---|
| 22 | */ |
---|
| 23 | int no_gen; |
---|
| 24 | |
---|
| 25 | /** |
---|
| 26 | * the number of genes contained by a chromosome |
---|
| 27 | */ |
---|
| 28 | int length; |
---|
| 29 | |
---|
| 30 | /** |
---|
| 31 | * the input graph of tasks |
---|
| 32 | */ |
---|
| 33 | TaskGraf tasks; |
---|
| 34 | |
---|
| 35 | /** |
---|
| 36 | * the input graph of processors |
---|
| 37 | */ |
---|
| 38 | ProcesorGraf procs; |
---|
| 39 | |
---|
| 40 | /** |
---|
| 41 | * the best chromosome of the current population |
---|
| 42 | */ |
---|
| 43 | Chromosome best; |
---|
| 44 | public: |
---|
| 45 | /** |
---|
| 46 | * the constructor |
---|
| 47 | * |
---|
| 48 | * @param i the number of chromosomes |
---|
| 49 | * @param g the number of generations the population will evolve |
---|
| 50 | * @param l the number of genes contained by a chromosome |
---|
| 51 | * @param t the input graph of tasks |
---|
| 52 | * @param p the input graph of processors |
---|
| 53 | */ |
---|
| 54 | Population(int i = 0 , int g = 0, int l = 0 , TaskGraf t = NULL, ProcesorGraf p = NULL); |
---|
| 55 | |
---|
| 56 | /** |
---|
| 57 | * method starting the population's evolution |
---|
| 58 | */ |
---|
| 59 | void run(); |
---|
| 60 | |
---|
| 61 | /** |
---|
| 62 | * method that returns the best chromosome obtained |
---|
| 63 | * |
---|
| 64 | * @return the best chromosome of the current population |
---|
| 65 | */ |
---|
| 66 | Chromosome getBest(); |
---|
| 67 | }; |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.