Add IterationSummary::step_is_nonmonotonic.

So that IterationCallback objects know the kind of step that they
are dealing with.

Change-Id: I7782b211af882bd7b67307c3c23d8021cb56e8ab
This commit is contained in:
Sameer Agarwal
2012-09-25 09:04:41 -07:00
parent d3ace02d13
commit b23fd4e667
3 changed files with 35 additions and 5 deletions
+2 -2
View File
@@ -34,8 +34,8 @@
#ifndef CERES_PUBLIC_CERES_H_
#define CERES_PUBLIC_CERES_H_
#define CERES_VERSION 1.3.0
#define CERES_ABI_VERSION 1.3.0
#define CERES_VERSION 1.4.0
#define CERES_ABI_VERSION 1.4.0
#include "ceres/autodiff_cost_function.h"
#include "ceres/cost_function.h"
+32 -3
View File
@@ -42,6 +42,21 @@ namespace ceres {
// This struct describes the state of the optimizer after each
// iteration of the minimization.
struct IterationSummary {
IterationSummary()
: iteration(0),
step_is_valid(false),
step_is_nonmonotonic(false),
step_is_successful(false),
cost(0.0),
cost_change(0.0),
gradient_max_norm(0.0),
step_norm(0.0),
eta(0.0),
linear_solver_iterations(0),
iteration_time_in_seconds(0.0),
step_solver_time_in_seconds(0.0),
cumulative_time_in_seconds(0.0) {}
// Current iteration number.
int32 iteration;
@@ -51,7 +66,22 @@ struct IterationSummary {
// Note: step_is_valid is false when iteration = 0.
bool step_is_valid;
// Whether or not the algorithm made progress in this iteration.
// Step did not reduce the value of the objective function
// sufficiently, but it was accepted because of the relaxed
// acceptance criterion used by the non-monotonic trust region
// algorithm.
//
// Note: step_is_nonmonotonic is false when iteration = 0;
bool step_is_nonmonotonic;
// Whether or not the minimizer accepted this step or not. If the
// ordinary trust region algorithm is used, this means that the
// relative reduction in the objective function value was greater
// than Solver::Options::min_relative_decrease. However, if the
// non-monotonic trust region algorithm is used
// (Solver::Options:use_nonmonotonic_steps = true), then even if the
// relative decrease is not sufficient, the algorithm may accept the
// step and the step is declared successful.
//
// Note: step_is_successful is false when iteration = 0.
bool step_is_successful;
@@ -60,8 +90,7 @@ struct IterationSummary {
double cost;
// Change in the value of the objective function in this
// iteration. This can be positive or negative. Negative change
// means that the step was not successful.
// iteration. This can be positive or negative.
double cost_change;
// Infinity norm of the gradient vector.
+1
View File
@@ -397,6 +397,7 @@ void TrustRegionMinimizer::Minimize(const Minimizer::Options& options,
accumulated_candidate_model_cost_change += model_cost_change;
accumulated_reference_model_cost_change += model_cost_change;
if (relative_decrease <= options_.min_relative_decrease) {
iteration_summary.step_is_nonmonotonic = true;
VLOG(2) << "Non-monotonic step! "
<< " relative_decrease: " << relative_decrease
<< " historical_relative_decrease: "