Added a benchmark tool

This commit is contained in:
2020-07-08 20:38:37 -04:00
parent a7d960c3b1
commit 766af92f1a
68 changed files with 546 additions and 134 deletions

View File

@@ -237,15 +237,6 @@ std::vector<int> Problem67::list[NUM_ROWS] = {
};
Problem67::Problem67() : Problem("Find the maximum total from the top to the bottom of the pyramid."){
//The method that I am using looks for the smallest numbers, so I need to invert the numbers in this list
invert();
//Now l[i][j] == 100 - l[i][j];
//Add the top point because that is already the only path
foundPoints.emplace_back(0, 0, list[0][0], false);
//Add the second row as possible points
possiblePoints.emplace_back(0, 1, (list[0][0] + list[1][0]), true);
possiblePoints.emplace_back(1, 1, list[0][0] + list[1][1], false);
}
void Problem67::invert(){
@@ -265,6 +256,16 @@ void Problem67::solve(){
//Start the timer
timer.start();
//The method that I am using looks for the smallest numbers, so I need to invert the numbers in this list
invert();
//Now l[i][j] == 100 - l[i][j];
//Add the top point because that is already the only path
foundPoints.emplace_back(0, 0, list[0][0], false);
//Add the second row as possible points
possiblePoints.emplace_back(0, 1, (list[0][0] + list[1][0]), true);
possiblePoints.emplace_back(1, 1, list[0][0] + list[1][1], false);
bool foundBottom = false; //Used when you find a point at the bottom
//Loop until you find the bottom
@@ -402,4 +403,12 @@ int Problem67::getTotal() const{
throw unsolved();
}
return actualTotal;
}
}
//Clears all of the variables so the problem can be run again
void Problem67::reset(){
Problem::reset();
foundPoints.clear();
possiblePoints.clear();
actualTotal = 0;
}