| 218 | } |
| 219 | |
| 220 | std::string GradientProblemSolver::Summary::FullReport() const { |
| 221 | using internal::VersionString; |
| 222 | |
| 223 | // NOTE operator+ is not usable for concatenating a string and a string_view. |
| 224 | std::string report = |
| 225 | std::string{"\nSolver Summary (v "}.append(VersionString()) + ")\n\n"; |
| 226 | |
| 227 | StringAppendF(&report, "Parameters % 25d\n", num_parameters); |
| 228 | if (num_tangent_parameters != num_parameters) { |
| 229 | StringAppendF( |
| 230 | &report, "Tangent parameters % 25d\n", num_tangent_parameters); |
| 231 | } |
| 232 | |
| 233 | std::string line_search_direction_string; |
| 234 | if (line_search_direction_type == LBFGS) { |
| 235 | line_search_direction_string = StringPrintf("LBFGS (%d)", max_lbfgs_rank); |
| 236 | } else if (line_search_direction_type == NONLINEAR_CONJUGATE_GRADIENT) { |
| 237 | line_search_direction_string = NonlinearConjugateGradientTypeToString( |
| 238 | nonlinear_conjugate_gradient_type); |
| 239 | } else { |
| 240 | line_search_direction_string = |
| 241 | LineSearchDirectionTypeToString(line_search_direction_type); |
| 242 | } |
| 243 | |
| 244 | StringAppendF(&report, |
| 245 | "Line search direction %19s\n", |
| 246 | line_search_direction_string.c_str()); |
| 247 | |
| 248 | const std::string line_search_type_string = StringPrintf( |
| 249 | "%s %s", |
| 250 | LineSearchInterpolationTypeToString(line_search_interpolation_type), |
| 251 | LineSearchTypeToString(line_search_type)); |
| 252 | StringAppendF(&report, |
| 253 | "Line search type %19s\n", |
| 254 | line_search_type_string.c_str()); |
| 255 | StringAppendF(&report, "\n"); |
| 256 | |
| 257 | StringAppendF(&report, "\nCost:\n"); |
| 258 | StringAppendF(&report, "Initial % 30e\n", initial_cost); |
| 259 | if (termination_type != FAILURE && termination_type != USER_FAILURE) { |
| 260 | StringAppendF(&report, "Final % 30e\n", final_cost); |
| 261 | StringAppendF(&report, "Change % 30e\n", initial_cost - final_cost); |
| 262 | } |
| 263 | |
| 264 | StringAppendF(&report, |
| 265 | "\nMinimizer iterations % 16d\n", |
| 266 | static_cast<int>(iterations.size())); |
| 267 | |
| 268 | StringAppendF(&report, "\nTime (in seconds):\n"); |
| 269 | StringAppendF(&report, |
| 270 | "\n Cost evaluation %23.6f (%d)\n", |
| 271 | cost_evaluation_time_in_seconds, |
| 272 | num_cost_evaluations); |
| 273 | StringAppendF(&report, |
| 274 | " Gradient & cost evaluation %16.6f (%d)\n", |
| 275 | gradient_evaluation_time_in_seconds, |
| 276 | num_gradient_evaluations); |
| 277 | StringAppendF(&report, |
nothing calls this directly
no test coverage detected