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:
Sameer Agarwal
2019-06-04 21:57:01 -07:00
parent 059bcb7f86
commit bf709ecac2
15 changed files with 393 additions and 246 deletions
+12 -34
View File
@@ -36,7 +36,6 @@
#include <string>
#include <vector>
#include "ceres/crs_matrix.h"
#include "ceres/evaluation_callback.h"
#include "ceres/internal/disable_warnings.h"
#include "ceres/internal/port.h"
#include "ceres/iteration_callback.h"
@@ -697,26 +696,18 @@ class CERES_EXPORT Solver {
// optimistic. This number should be exposed for users to change.
double gradient_check_numeric_derivative_relative_step_size = 1e-6;
// If true, the user's parameter blocks are updated at the end of
// every Minimizer iteration, otherwise they are updated when the
// Minimizer terminates. This is useful if, for example, the user
// wishes to visualize the state of the optimization every iteration
// (in combination with an IterationCallback).
//
// NOTE: If an evaluation_callback is provided, then the behaviour
// of this flag is slightly different in each case:
//
// (1) If update_state_every_iteration = false, then the user's
// state is changed at every residual and/or jacobian evaluation.
// Any user provided IterationCallbacks should NOT inspect and
// depend on the user visible state while the solver is running,
// since there will be undefined contents.
//
// (2) If update_state_every_iteration is true, then the user's
// state is changed at every residual and/or jacobian evaluation,
// BUT the solver will ensure that before the user provided
// IterationCallbacks are called, the user visible state will be
// updated to the current best point found by the solver.
// If update_state_every_iteration is true, then Ceres Solver will
// guarantee that at the end of every iteration and before any
// user provided IterationCallback is called, the parameter blocks
// are updated to the current best solution found by the
// solver. Thus the IterationCallback can inspect the values of
// the parameter blocks for purposes of computation, visualization
// or termination.
// If update_state_every_iteration is false then there is no such
// guarantee, and user provided IterationCallbacks should not
// expect to look at the parameter blocks and interpret their
// values.
bool update_state_every_iteration = false;
// Callbacks that are executed at the end of each iteration of the
@@ -735,19 +726,6 @@ class CERES_EXPORT Solver {
//
// The solver does NOT take ownership of these pointers.
std::vector<IterationCallback*> callbacks;
// If non-NULL, gets notified when Ceres is about to evaluate the
// residuals and/or Jacobians. This enables sharing computation
// between residuals, which in some cases is important for efficient
// cost evaluation. See evaluation_callback.h for details.
//
// NOTE: Evaluation callbacks are incompatible with inner iterations.
//
// WARNING: This interacts with update_state_every_iteration. See
// the documentation for that option for more details.
//
// The solver does NOT take ownership of the pointer.
EvaluationCallback* evaluation_callback = nullptr;
};
struct CERES_EXPORT Summary {