Message
Message
h>
template<typename T>
class History{
public:
T value;
vector<T> history;
History(T& init){
value = init;
}
History(){
value = NULL;
}
};
class Cell {
public:
void updatePerformance(){
//this is the bit of code you have to write.
//update other values as well here.
}
class GridSearch {
public:
int rows, cols;
vector<vector<Cell>> grid;
History<float> directionHistory;
GridSearch(int par1min, int par1max, int par1step, int par2min, int par2max,
int par2step){
for (int par1 = par1min; par1 <= par1max; par1+=par1step) {
grid.push_back({});
for (int par2 = par2min; par2 <= par2max; par2+=par2step){
grid.back().push_back(Cell(par1, par2));
}
}
}
void updatePerformance(){
for (auto& row : grid){
for (auto& cell : row){
cell.updatePerformance();
}
}
normalizePerformance();
}
//if you use updateperformance every itaration you can remove normalize
performance from the functions below.
void normalizePerformance(){
int maxPerf = INT_MIN, minPerf = INT_MAX;
for (auto& row : grid){
for (auto & cell : row){
maxPerf = max(maxPerf, cell.performance);
minPerf = min(minPerf, cell.performance);
}
}
int getBestPar1(){
int sum1 = 0, sum2 = 0;
normalizePerformance();
}
int getBestPar2(){
int sum1 = 0, sum2 = 0;
normalizePerformance();
}
};
int main(){