-
Notifications
You must be signed in to change notification settings - Fork 0
/
ga.h
83 lines (43 loc) · 1.51 KB
/
ga.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* File: ga.h
* Author: rick
*
* Created on June 4, 2011, 11:24 AM
*/
#ifndef GA_H
#define GA_H
#define MAX_LENGTH 249
#define SHOW_REPLACEMENT false
int** initChromosomes (int size, int ell);
void initializePopulation ();
void initGA (int n_ell, int n_nInitial, int n_selectionPressure, double n_pc, double n_pm, int n_maxGen, int n_maxFe, int optimalFit);
void evaluate( int** group, int* fitnessArray);
void oneMax( int** group, int* fitnessArray);
void evaluateBuildOrder( int** group, int* fitnessArray);
void selection();
void tournament ();
void copyChromosome(int* p, int* q);
void crossover();
void pairwiseXO (int* p1, int* p2, int* c1, int* c2);
void onePointXO (int* p1, int* p2, int* c1, int* c2);
int decideCrossSite(int* p1, int* p2, int& crossSite1, int& crossSite2);
void fullReplace ();
void RTR ();
int getDistance (int* & c1, int* & c2);
void mutation ();
void mutationClock ();
void mutateChromosome(int* chromosome, int r );
int doIt (int optimalFit, int maxGeneration, int maxNFe, bool output);
bool shouldTerminate ();
void oneRun (bool output);
void showStatistics () ;
void printChromosome(int* chromosome);
void printPopulation(int** group);
void printPopulationAndFitness(int** group);
void printFitness(int populationOrOffspring , int ith);
void processRequest(int request[60]);
void initializePopulationByRequest ();
void generateChromosomeByRequest(int* chromosome);
void modifyChromosomeByRequest(int* chromosome);
void modifyChromosome();
#endif /* GA_H */