Make the Evaluator statistics key strings consistent

We keep track of evaluator call and time statistics
via a hashmap containing magic strings. These strings
need to be consistent across the GradientProblemSolver
and Solver as the LineSearchMinimizer is used by both
of these solvers. Previously they were inconsistent
in a manner that GradientProblemSolver was not getting
information about the evaluation timing, and in the
process of fixing that I made it so that the TrustRegionMinimizer
when solving bounds constrained probelms will access/update
this information correctly.

So while I look for a more elegant solution, this CL
is meant to fix the inconsistency by making sure that the
same magic strings are used everywhere.

Change-Id: I120ca0bd1c2f77fde2db15edd9e33286a49dbae9
This commit is contained in:
Sameer Agarwal
2017-06-29 07:28:27 -07:00
parent a9977da3eb
commit 19382f0460
2 changed files with 14 additions and 7 deletions
+4 -4
View File
@@ -166,15 +166,15 @@ void GradientProblemSolver::Solve(const GradientProblemSolver::Options& options,
const std::map<string, double>& evaluator_time_statistics =
minimizer_options.evaluator->TimeStatistics();
summary->cost_evaluation_time_in_seconds =
FindWithDefault(evaluator_time_statistics, "Evaluator::Cost", 0.0);
FindWithDefault(evaluator_time_statistics, "Evaluator::Residual", 0.0);
summary->gradient_evaluation_time_in_seconds =
FindWithDefault(evaluator_time_statistics, "Evaluator::Gradient", 0.0);
FindWithDefault(evaluator_time_statistics, "Evaluator::Jacobian", 0.0);
const std::map<string, int>& evaluator_call_statistics =
minimizer_options.evaluator->CallStatistics();
summary->num_cost_evaluations =
FindWithDefault(evaluator_call_statistics, "Evaluator::Cost", 0);
FindWithDefault(evaluator_call_statistics, "Evaluator::Residual", 0);
summary->num_gradient_evaluations =
FindWithDefault(evaluator_call_statistics, "Evaluator::Gradient", 0);
FindWithDefault(evaluator_call_statistics, "Evaluator::Jacobian", 0);
summary->total_time_in_seconds = WallTimeInSeconds() - start_time;
}