Exporting number of function calls in the csv
This commit is contained in:
parent
1c3cc8e014
commit
717f631095
|
@ -135,7 +135,7 @@ int main(int argc, char *argv[]) {
|
|||
settings_optimization.writeHeaderTo(csv_results);
|
||||
csv_results << endrow;
|
||||
csv_results << std::to_string(fullPattern.EN()) + "#" + pairName;
|
||||
optimizationResults.writeResultsTo(settings_optimization, csv_results);
|
||||
optimizationResults.writeResultsTo(csv_results);
|
||||
settings_optimization.writeSettingsTo(csv_results);
|
||||
csv_results << endrow;
|
||||
} else {
|
||||
|
|
|
@ -23,6 +23,7 @@ struct GlobalOptimizationVariables {
|
|||
std::vector<double> objectiveValueHistoryY;
|
||||
std::vector<double> objectiveValueHistoryX;
|
||||
std::vector<double> plotColors;
|
||||
size_t iterationOfMinima{0};
|
||||
Eigen::VectorXd initialParameters;
|
||||
std::vector<int> simulationScenarioIndices;
|
||||
double minY{DBL_MAX};
|
||||
|
@ -253,34 +254,35 @@ double ReducedModelOptimizer::objective(const dlib::matrix<double, 0, 1> &x)
|
|||
}
|
||||
}
|
||||
// std::cout << error << std::endl;
|
||||
// global.objectiveValueHistory.push_back(totalError);
|
||||
// global.plotColors.push_back(10);
|
||||
++global.numberOfFunctionCalls;
|
||||
if (totalError < global.minY) {
|
||||
global.minY = totalError;
|
||||
std::cout << "New best:" << totalError << std::endl;
|
||||
// global.minX.assign(x.begin(), x.begin() + n);
|
||||
std::cout.precision(17);
|
||||
for (int i = 0; i < x.size(); i++) {
|
||||
std::cout << x(i) << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
global.objectiveValueHistoryY.push_back(std::log(totalError));
|
||||
global.objectiveValueHistoryX.push_back(global.numberOfFunctionCalls);
|
||||
global.plotColors.push_back(0.1);
|
||||
global.iterationOfMinima = global.numberOfFunctionCalls;
|
||||
// std::cout << "New best:" << totalError << std::endl;
|
||||
// // global.minX.assign(x.begin(), x.begin() + n);
|
||||
// std::cout.precision(17);
|
||||
// for (int i = 0; i < x.size(); i++) {
|
||||
// std::cout << x(i) << " ";
|
||||
// }
|
||||
// std::cout << std::endl;
|
||||
// global.objectiveValueHistoryY.push_back(std::log(totalError));
|
||||
// global.objectiveValueHistoryX.push_back(global.numberOfFunctionCalls);
|
||||
// global.plotColors.push_back(0.1);
|
||||
// auto xPlot = matplot::linspace(0,
|
||||
// global.objectiveValueHistoryY.size(),
|
||||
// global.objectiveValueHistoryY.size());
|
||||
global.gPlotHandle = matplot::scatter(global.objectiveValueHistoryX,
|
||||
global.objectiveValueHistoryY,
|
||||
4,
|
||||
global.plotColors);
|
||||
// global.gPlotHandle = matplot::scatter(global.objectiveValueHistoryX,
|
||||
// global.objectiveValueHistoryY,
|
||||
// 4,
|
||||
// global.plotColors);
|
||||
// matplot::show();
|
||||
// SimulationResultsReporter::createPlot("Number of Steps",
|
||||
// "Objective value",
|
||||
// global.objectiveValueHistoryY);
|
||||
}
|
||||
// global.objectiveValueHistory.push_back(totalError);
|
||||
// global.plotColors.push_back(10);
|
||||
#ifdef POLYSCOPE_DEFINED
|
||||
++global.numberOfFunctionCalls;
|
||||
if (global.optimizationSettings.numberOfFunctionCalls >= 100
|
||||
&& global.numberOfFunctionCalls % (global.optimizationSettings.numberOfFunctionCalls / 100)
|
||||
== 0) {
|
||||
|
@ -959,6 +961,7 @@ void ReducedModelOptimizer::getResults(const dlib::function_evaluation &optimiza
|
|||
// global.reducedPatternSimulationJobs[simulationScenarioIndex]->pMesh->registerForDrawing();
|
||||
// global.reducedPatternSimulationJobs[simulationScenarioIndex]->pMesh->setLabel(temp);
|
||||
}
|
||||
results.iterationOfMinima = global.iterationOfMinima;
|
||||
// results.draw();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue