|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
C + + in the end how the class structure?
The following are the categories I wrote a genetic algorithm, the structure type is always wrong, I am not aware of what the public, which the private?
#include "Stdlib.h> 4003rd function in the (4,4) - should be the maximum [-4,4)
#include "Math.h>
#include "Time.h>
#include "String.h>
//#include "GA2Dlg.h"
Const int size POPSIZE=10;//population
Const double Pc=0.8; //crossover probability
Const double Pm=0.005;//mutation probability
Const double G=0.8; //generation gap
Const int length of a variable LENGTH=22; 4003rd
Const int Maxgeneration=20;
Const int N=2; 4003rd function of the number of variables;
Struct indivaual
{char Chrom[N*LENGTH];
Double value;
Double fitness;
};
14.00 GA
{
Void decode (struct indivaual 6-12);
Reproduction void (); 4003rd complex system generated matingpool
Crossover void ();
Mutation void (); 4003rd gene mutation
4003rd variable double value[POPSIZE][N];
Public :
Struct indivaual population[POPSIZE];
Struct indivaual matingpool[POPSIZE];
GA ();
GenerateInitialPopulation void ();
Void Function (struct indivaual 6-12);
Void Fitness (struct indivaual 6-12);
GenerateNextpopulation void ();
Void Order (struct indivaual *q); 4003rd classification
Void OutputTextReport (CListBox& m_list, int generation);
Virtual ~GA ();
}; |
The kind you use natural language to describe, it is understood. |
I try It is a good idea, I will try. Thank you, the. |
| |