Dogleg strategy and timing cleanups.
1. A new dogleg trust region strategy.
2. Consistent naming of all variables taking and reporting
time. Also all are doubles now.
3. Enum to stringification routines.
4. bundle_adjuster.cc accepts max solver time and trust_region_strategy.
5. Time accounting is pushed into solver_impl.cc and there is now
postprocessing time accounted for explicitly.
6. IterationCallback now has cumulative time.
7. LoggingCallback logs per iteration and cumulative time.
8. TrustRegionStrategy now allows for Invalid steps to be indicated
explicitly.
9. Trust region minimizer actually terminates on max_solver_time.
Change-Id: I7e3b82c8beebc17b6b355ea46ddd280754a2d8b2
diff --git a/examples/bundle_adjuster.cc b/examples/bundle_adjuster.cc
index 1216a82..5e1b3a6 100644
--- a/examples/bundle_adjuster.cc
+++ b/examples/bundle_adjuster.cc
@@ -84,6 +84,8 @@
"parameterization.");
DEFINE_bool(robustify, false, "Use a robust loss function");
DEFINE_bool(use_block_amd, true, "Use a block oriented fill reducing ordering.");
+DEFINE_string(trust_region_strategy, "lm", "Options are: lm, dogleg");
+DEFINE_double(max_solver_time, 1e32, "Maximum solve time in seconds.");
namespace ceres {
namespace examples {
@@ -218,6 +220,15 @@
options->minimizer_progress_to_stdout = true;
options->num_threads = FLAGS_num_threads;
options->eta = FLAGS_eta;
+ options->max_solver_time_in_seconds = FLAGS_max_solver_time;
+ if (FLAGS_trust_region_strategy == "lm") {
+ options->trust_region_strategy_type = LEVENBERG_MARQUARDT;
+ } else if (FLAGS_trust_region_strategy == "dogleg") {
+ options->trust_region_strategy_type = DOGLEG;
+ } else {
+ LOG(FATAL) << "Unknown trust region strategy: "
+ << FLAGS_trust_region_strategy;
+ }
}
void SetSolverOptionsFromFlags(BALProblem* bal_problem,