mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Move EvaluationCallback from Solver::Options to Problem::Options.
Adding it to Solver::Options was a mistake, as it prevents it from being used in covariance estimation. Also updated associated docs. https://github.com/ceres-solver/ceres-solver/issues/380 https://github.com/ceres-solver/ceres-solver/issues/401 https://github.com/ceres-solver/ceres-solver/issues/484 Change-Id: I63809a47a58e84c04a58bf8e59ace92f45fc2873
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "ceres/evaluation_callback.h"
|
||||
#include "ceres/sized_cost_function.h"
|
||||
#include "ceres/problem.h"
|
||||
#include "ceres/problem_impl.h"
|
||||
@@ -193,6 +194,7 @@ TEST(EvaluationCallback, WithTrustRegionMinimizer) {
|
||||
|
||||
WigglyBowlCostFunctionAndEvaluationCallback cost_function(parameters);
|
||||
Problem::Options problem_options;
|
||||
problem_options.evaluation_callback = &cost_function;
|
||||
problem_options.cost_function_ownership = DO_NOT_TAKE_OWNERSHIP;
|
||||
Problem problem(problem_options);
|
||||
problem.AddResidualBlock(&cost_function, NULL, parameters);
|
||||
@@ -200,7 +202,6 @@ TEST(EvaluationCallback, WithTrustRegionMinimizer) {
|
||||
Solver::Options options;
|
||||
options.linear_solver_type = DENSE_QR;
|
||||
options.max_num_iterations = 300; // Cost function is hard.
|
||||
options.evaluation_callback = &cost_function;
|
||||
|
||||
// Run the solve. Checking is done inside the cost function / callback.
|
||||
Solver::Summary summary;
|
||||
@@ -240,6 +241,7 @@ static void WithLineSearchMinimizerImpl(
|
||||
|
||||
WigglyBowlCostFunctionAndEvaluationCallback cost_function(parameters);
|
||||
Problem::Options problem_options;
|
||||
problem_options.evaluation_callback = &cost_function;
|
||||
problem_options.cost_function_ownership = DO_NOT_TAKE_OWNERSHIP;
|
||||
Problem problem(problem_options);
|
||||
problem.AddResidualBlock(&cost_function, NULL, parameters);
|
||||
@@ -248,7 +250,7 @@ static void WithLineSearchMinimizerImpl(
|
||||
options.linear_solver_type = DENSE_QR;
|
||||
options.max_num_iterations = 300; // Cost function is hard.
|
||||
options.minimizer_type = ceres::LINE_SEARCH;
|
||||
options.evaluation_callback = &cost_function;
|
||||
|
||||
options.line_search_type = line_search;
|
||||
options.line_search_direction_type = line_search_direction;
|
||||
options.line_search_interpolation_type = line_search_interpolation;
|
||||
|
||||
Reference in New Issue
Block a user