-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGlobalOptimisation.h
More file actions
168 lines (116 loc) · 3.4 KB
/
GlobalOptimisation.h
File metadata and controls
168 lines (116 loc) · 3.4 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#ifndef OPTIMISATION_H
#define OPTIMISATION_H
/**
02/06/2011
- Commented out headers inherited from Utils.h
**/
// #include <cstdlib>
// #include <iostream>
// #include <vector>
// #include <string>
// #include "Structures.h"
// #include <omp.h>
// #include "math.h"
// #include "Utils.h"
#include "GlobalOptimisationMutation.h"
#include "GlobalOptimisationOffspring.h"
// #include "GlobalOptimisationUtils.h"
class GlobalOptimisation{
public:
GlobalOptimisation() {idum = NULL; output_content = NULL;}
~GlobalOptimisation() {;}
GlobalOptimisation(int *s, std::vector<std::string> *o)
{ init(s,o); }
void init(int *s, std::vector<std::string> *o);
void setTempPoint(const RotationPoint &l)
{ tempPoint = l; }
void setTempPoint(const float t, const float ph, const float ps, const float v)
{ tempPoint.theta = t; tempPoint.phi = ph; tempPoint.psi = ps; tempPoint.value = v;}
void setPoint(const RotationPoint &l);
void setPoints(const std::vector<RotationPoint> &rp);
// Sets random start points
void setRandomStartPoints()
{newPoints = getRandomPoints(size,idum,getSearchLimits());}
void setReference(const std::string &r)
{ reference = r; }
void setSearchLimits(const LinearStruct &sl)
{ searchLimits = sl; }
void setSize(const int &s)
{ size = s; points.resize(s); }
RotationPoint getTempPoint()
{ return tempPoint; }
RotationPoint getNewPoint();
std::vector<RotationPoint> getNewPoints();
LinearStruct getSearchLimits()
{ return searchLimits; }
int getSize()
{ return size; }
bool getPopulationFull();
int getPopulationSize()
{ return size; }
bool getMutantsFull();
int getMutantsSize()
{ return numberOfMutants; }
bool getOffspringFull();
int getOffspringSize()
{ return numberOfOffspring; }
bool getConverged()
{ return bConverged; }
bool getbScreen()
{ return bScreen; }
std::string getReference()
{ return reference; }
void newPopulation();
RotationPoint getCurrentMin()
{ return minimum; }
LinearStruct minimisationPoints(const Direction &d);
void setVariables(GaV ga_v);
void printMinimum();
void printTempPoint(const std::string &front);
RotationPoint getMinimumPoint()
{return minimum;}
void setMinimumPoint(RotationPoint rp)
{minimum = rp;}
private:
void setUp();
void resetPoints();
void checkConverged();
void next()
{ current++; }
void nextMutant()
{ current_mutant++; }
void nextOffspring()
{ current_offspring++; }
void printSetPoints();
std::string reference;
OptimisationOffspring oo;
OptimisationMutation om;
std::vector<RotationPoint> points;
std::vector<RotationPoint> newPoints;
std::vector<RotationPoint> mutants;
std::vector<RotationPoint> offspring;
RotationPoint tempPoint;
RotationPoint minimum;
LinearStruct searchLimits;
int size; // NUMBER IN OPTIMIZATION
int current; // CURRENT NUMBER
int generations; // NUMBER OF GENERATIONS BEFORE TERMINATION
int current_generation_count; // COUNT OFF CURRENT ROTATIONS AT THIS LOW
int tsize; // TOURNAMENT SIZE
float mrate; // MUTATION RATE
float noff; // PERCENTAGE OFFSPRING
int numberOfMutants;
int current_mutant;
int numberOfOffspring;
int current_offspring;
int *idum; // Pointer for random number generator
std::vector<std::string> *output_content;
bool bPopulationFull;
bool bMutantsFull;
bool bOffspringFull;
bool bConverged;
bool bScreen;
// TYPES OF MUTATION
bool bMChildren;
};
#endif