MCPcopy Create free account
hub / github.com/ceres-solver/ceres-solver / SetupCommonMinimizerOptions

Function SetupCommonMinimizerOptions

internal/ceres/preprocessor.cc:75–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75void SetupCommonMinimizerOptions(PreprocessedProblem* pp) {
76 const Solver::Options& options = pp->options;
77 Program* program = pp->reduced_program.get();
78
79 // Assuming that the parameter blocks in the program have been
80 // reordered as needed, extract them into a contiguous vector.
81 pp->reduced_parameters.resize(program->NumParameters());
82 double* reduced_parameters = pp->reduced_parameters.data();
83 program->ParameterBlocksToStateVector(reduced_parameters);
84
85 auto context = pp->problem->context();
86 Minimizer::Options& minimizer_options = pp->minimizer_options;
87 minimizer_options = Minimizer::Options(options);
88 minimizer_options.evaluator = pp->evaluator;
89 minimizer_options.context = context;
90
91 if (options.logging_type != SILENT) {
92 pp->logging_callback = std::make_unique<LoggingCallback>(
93 options.minimizer_type, options.minimizer_progress_to_stdout);
94 minimizer_options.callbacks.insert(minimizer_options.callbacks.begin(),
95 pp->logging_callback.get());
96 }
97
98 if (options.update_state_every_iteration) {
99 pp->state_updating_callback =
100 std::make_unique<StateUpdatingCallback>(program, reduced_parameters);
101 // This must get pushed to the front of the callbacks so that it
102 // is run before any of the user callbacks.
103 minimizer_options.callbacks.insert(minimizer_options.callbacks.begin(),
104 pp->state_updating_callback.get());
105 }
106}
107
108} // namespace ceres::internal

Callers 2

SetupMinimizerOptionsFunction · 0.85
PreprocessMethod · 0.85

Calls 7

getMethod · 0.80
contextMethod · 0.80
OptionsClass · 0.70
NumParametersMethod · 0.45
dataMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected