Rationalize some of the variable names in Solver::Options.

lm_max_diagonal -> max_lm_diagonal
lm_min_diagonal -> min_lm_diagonal
linear_solver_max_num_iterations -> max_linear_solver_iterations
linear_solver_min_num_iterations -> min_linear_solver_iterations

This follows the pattern for the other parameters in Solver::Options
where, the max/min is the first word followed by the name of the
parameter.

Change-Id: I0893610fceb6b7983fdb458a65522ba7079596a7
This commit is contained in:
Sameer Agarwal
2013-07-07 23:04:31 -07:00
parent 7a8f797924
commit eeedd2e191
10 changed files with 51 additions and 51 deletions
+4 -4
View File
@@ -933,7 +933,7 @@ elimination group [LiSaad]_.
Lower threshold for relative decrease before a trust-region step is
accepted.
.. member:: double Solver::Options::lm_min_diagonal
.. member:: double Solver::Options::min_lm_diagonal
Default: ``1e6``
@@ -941,7 +941,7 @@ elimination group [LiSaad]_.
regularize the the trust region step. This is the lower bound on
the values of this diagonal matrix.
.. member:: double Solver::Options::lm_max_diagonal
.. member:: double Solver::Options::max_lm_diagonal
Default: ``1e32``
@@ -1071,7 +1071,7 @@ elimination group [LiSaad]_.
expense of an extra copy of the Jacobian matrix. Setting
``use_postordering`` to ``true`` enables this tradeoff.
.. member:: int Solver::Options::linear_solver_min_num_iterations
.. member:: int Solver::Options::min_linear_solver_iterations
Default: ``1``
@@ -1079,7 +1079,7 @@ elimination group [LiSaad]_.
makes sense when the linear solver is an iterative solver, e.g.,
``ITERATIVE_SCHUR`` or ``CGNR``.
.. member:: int Solver::Options::linear_solver_max_num_iterations
.. member:: int Solver::Options::max_linear_solver_iterations
Default: ``500``
+11 -11
View File
@@ -80,8 +80,8 @@ class Solver {
max_trust_region_radius = 1e16;
min_trust_region_radius = 1e-32;
min_relative_decrease = 1e-3;
lm_min_diagonal = 1e-6;
lm_max_diagonal = 1e32;
min_lm_diagonal = 1e-6;
max_lm_diagonal = 1e32;
max_num_consecutive_invalid_steps = 5;
function_tolerance = 1e-6;
gradient_tolerance = 1e-10;
@@ -103,8 +103,8 @@ class Solver {
num_linear_solver_threads = 1;
linear_solver_ordering = NULL;
use_postordering = false;
linear_solver_min_num_iterations = 1;
linear_solver_max_num_iterations = 500;
min_linear_solver_iterations = 1;
max_linear_solver_iterations = 500;
eta = 1e-1;
jacobi_scaling = true;
use_inner_iterations = false;
@@ -274,11 +274,11 @@ class Solver {
// the normal equations J'J is used to control the size of the
// trust region. Extremely small and large values along the
// diagonal can make this regularization scheme
// fail. lm_max_diagonal and lm_min_diagonal, clamp the values of
// fail. max_lm_diagonal and min_lm_diagonal, clamp the values of
// diag(J'J) from above and below. In the normal course of
// operation, the user should not have to modify these parameters.
double lm_min_diagonal;
double lm_max_diagonal;
double min_lm_diagonal;
double max_lm_diagonal;
// Sometimes due to numerical conditioning problems or linear
// solver flakiness, the trust region strategy may return a
@@ -501,13 +501,13 @@ class Solver {
// Minimum number of iterations for which the linear solver should
// run, even if the convergence criterion is satisfied.
int linear_solver_min_num_iterations;
int min_linear_solver_iterations;
// Maximum number of iterations for which the linear solver should
// run. If the solver does not converge in less than
// linear_solver_max_num_iterations, then it returns
// MAX_ITERATIONS, as its termination type.
int linear_solver_max_num_iterations;
// max_linear_solver_iterations, then it returns MAX_ITERATIONS,
// as its termination type.
int max_linear_solver_iterations;
// Forcing sequence parameter. The truncated Newton solver uses
// this number to control the relative accuracy with which the
+2 -2
View File
@@ -53,8 +53,8 @@ DoglegStrategy::DoglegStrategy(const TrustRegionStrategy::Options& options)
: linear_solver_(options.linear_solver),
radius_(options.initial_radius),
max_radius_(options.max_radius),
min_diagonal_(options.lm_min_diagonal),
max_diagonal_(options.lm_max_diagonal),
min_diagonal_(options.min_lm_diagonal),
max_diagonal_(options.max_lm_diagonal),
mu_(kMinMu),
min_mu_(kMinMu),
max_mu_(kMaxMu),
+4 -4
View File
@@ -84,8 +84,8 @@ class DoglegStrategyFixtureEllipse : public Fixture {
x_.resize(6);
x_.setZero();
options_.lm_min_diagonal = 1.0;
options_.lm_max_diagonal = 1.0;
options_.min_lm_diagonal = 1.0;
options_.max_lm_diagonal = 1.0;
}
};
@@ -112,8 +112,8 @@ class DoglegStrategyFixtureValley : public Fixture {
x_.resize(6);
x_.setZero();
options_.lm_min_diagonal = 1.0;
options_.lm_max_diagonal = 1.0;
options_.min_lm_diagonal = 1.0;
options_.max_lm_diagonal = 1.0;
}
};
@@ -49,8 +49,8 @@ LevenbergMarquardtStrategy::LevenbergMarquardtStrategy(
: linear_solver_(options.linear_solver),
radius_(options.initial_radius),
max_radius_(options.max_radius),
min_diagonal_(options.lm_min_diagonal),
max_diagonal_(options.lm_max_diagonal),
min_diagonal_(options.min_lm_diagonal),
max_diagonal_(options.max_lm_diagonal),
decrease_factor_(2.0),
reuse_diagonal_(false) {
CHECK_NOTNULL(linear_solver_);
@@ -82,8 +82,8 @@ TEST(LevenbergMarquardtStrategy, AcceptRejectStepRadiusScaling) {
TrustRegionStrategy::Options options;
options.initial_radius = 2.0;
options.max_radius = 20.0;
options.lm_min_diagonal = 1e-8;
options.lm_max_diagonal = 1e8;
options.min_lm_diagonal = 1e-8;
options.max_lm_diagonal = 1e8;
// We need a non-null pointer here, so anything should do.
scoped_ptr<LinearSolver> linear_solver(
@@ -125,13 +125,13 @@ TEST(LevenbergMarquardtStrategy, CorrectDiagonalToLinearSolver) {
TrustRegionStrategy::Options options;
options.initial_radius = 2.0;
options.max_radius = 20.0;
options.lm_min_diagonal = 1e-2;
options.lm_max_diagonal = 1e2;
options.min_lm_diagonal = 1e-2;
options.max_lm_diagonal = 1e2;
double diagonal[3];
diagonal[0] = options.lm_min_diagonal;
diagonal[0] = options.min_lm_diagonal;
diagonal[1] = 2.0;
diagonal[2] = options.lm_max_diagonal;
diagonal[2] = options.max_lm_diagonal;
for (int i = 0; i < 3; ++i) {
diagonal[i] = sqrt(diagonal[i] / options.initial_radius);
}
+12 -12
View File
@@ -255,8 +255,8 @@ void SolverImpl::TrustRegionMinimize(
trust_region_strategy_options.initial_radius =
options.initial_trust_region_radius;
trust_region_strategy_options.max_radius = options.max_trust_region_radius;
trust_region_strategy_options.lm_min_diagonal = options.lm_min_diagonal;
trust_region_strategy_options.lm_max_diagonal = options.lm_max_diagonal;
trust_region_strategy_options.min_lm_diagonal = options.min_lm_diagonal;
trust_region_strategy_options.max_lm_diagonal = options.max_lm_diagonal;
trust_region_strategy_options.trust_region_strategy_type =
options.trust_region_strategy_type;
trust_region_strategy_options.dogleg_type = options.dogleg_type;
@@ -1091,26 +1091,26 @@ LinearSolver* SolverImpl::CreateLinearSolver(Solver::Options* options,
}
#endif
if (options->linear_solver_max_num_iterations <= 0) {
*error = "Solver::Options::linear_solver_max_num_iterations is 0.";
if (options->max_linear_solver_iterations <= 0) {
*error = "Solver::Options::max_linear_solver_iterations is not positive.";
return NULL;
}
if (options->linear_solver_min_num_iterations <= 0) {
*error = "Solver::Options::linear_solver_min_num_iterations is 0.";
if (options->min_linear_solver_iterations <= 0) {
*error = "Solver::Options::min_linear_solver_iterations is not positive.";
return NULL;
}
if (options->linear_solver_min_num_iterations >
options->linear_solver_max_num_iterations) {
*error = "Solver::Options::linear_solver_min_num_iterations > "
"Solver::Options::linear_solver_max_num_iterations.";
if (options->min_linear_solver_iterations >
options->max_linear_solver_iterations) {
*error = "Solver::Options::min_linear_solver_iterations > "
"Solver::Options::max_linear_solver_iterations.";
return NULL;
}
LinearSolver::Options linear_solver_options;
linear_solver_options.min_num_iterations =
options->linear_solver_min_num_iterations;
options->min_linear_solver_iterations;
linear_solver_options.max_num_iterations =
options->linear_solver_max_num_iterations;
options->max_linear_solver_iterations;
linear_solver_options.type = options->linear_solver_type;
linear_solver_options.preconditioner_type = options->preconditioner_type;
linear_solver_options.sparse_linear_algebra_library =
+4 -4
View File
@@ -509,7 +509,7 @@ TEST(SolverImpl, CreateLinearSolverNoSuiteSparse) {
TEST(SolverImpl, CreateLinearSolverNegativeMaxNumIterations) {
Solver::Options options;
options.linear_solver_type = DENSE_QR;
options.linear_solver_max_num_iterations = -1;
options.max_linear_solver_iterations = -1;
// CreateLinearSolver assumes a non-empty ordering.
options.linear_solver_ordering = new ParameterBlockOrdering;
string error;
@@ -520,7 +520,7 @@ TEST(SolverImpl, CreateLinearSolverNegativeMaxNumIterations) {
TEST(SolverImpl, CreateLinearSolverNegativeMinNumIterations) {
Solver::Options options;
options.linear_solver_type = DENSE_QR;
options.linear_solver_min_num_iterations = -1;
options.min_linear_solver_iterations = -1;
// CreateLinearSolver assumes a non-empty ordering.
options.linear_solver_ordering = new ParameterBlockOrdering;
string error;
@@ -531,8 +531,8 @@ TEST(SolverImpl, CreateLinearSolverNegativeMinNumIterations) {
TEST(SolverImpl, CreateLinearSolverMaxLessThanMinIterations) {
Solver::Options options;
options.linear_solver_type = DENSE_QR;
options.linear_solver_min_num_iterations = 10;
options.linear_solver_max_num_iterations = 5;
options.min_linear_solver_iterations = 10;
options.max_linear_solver_iterations = 5;
options.linear_solver_ordering = new ParameterBlockOrdering;
string error;
EXPECT_EQ(SolverImpl::CreateLinearSolver(&options, &error),
@@ -238,8 +238,8 @@ void IsTrustRegionSolveSuccessful(TrustRegionStrategyType strategy_type) {
trust_region_strategy_options.linear_solver = &linear_solver;
trust_region_strategy_options.initial_radius = 1e4;
trust_region_strategy_options.max_radius = 1e20;
trust_region_strategy_options.lm_min_diagonal = 1e-6;
trust_region_strategy_options.lm_max_diagonal = 1e32;
trust_region_strategy_options.min_lm_diagonal = 1e-6;
trust_region_strategy_options.max_lm_diagonal = 1e32;
scoped_ptr<TrustRegionStrategy> strategy(
TrustRegionStrategy::Create(trust_region_strategy_options));
minimizer_options.trust_region_strategy = strategy.get();
+4 -4
View File
@@ -60,8 +60,8 @@ class TrustRegionStrategy {
: trust_region_strategy_type(LEVENBERG_MARQUARDT),
initial_radius(1e4),
max_radius(1e32),
lm_min_diagonal(1e-6),
lm_max_diagonal(1e32),
min_lm_diagonal(1e-6),
max_lm_diagonal(1e32),
dogleg_type(TRADITIONAL_DOGLEG) {
}
@@ -75,8 +75,8 @@ class TrustRegionStrategy {
// by LevenbergMarquardtStrategy. The DoglegStrategy also uses
// these bounds to construct a regularizing diagonal to ensure
// that the Gauss-Newton step computation is of full rank.
double lm_min_diagonal;
double lm_max_diagonal;
double min_lm_diagonal;
double max_lm_diagonal;
// Further specify which dogleg method to use
DoglegType dogleg_type;