Fix to Roszman1's certified solution.

Extend nist.cc to test more nonlinear and linear solvers.

(Thanks to Markus Moll for finding the Roszman1 bug)

Change-Id: I92b4bab0771de85f7fe711fb0853f155991f4aaf
This commit is contained in:
Sameer Agarwal
2012-09-01 14:41:44 -07:00
parent 43904888cd
commit ca0ff62ddb
2 changed files with 55 additions and 17 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ Description: These data are the result of a NIST study involving
predictor variable is the excited energy state. predictor variable is the excited energy state.
The argument to the ARCTAN function is in radians. The argument to the ARCTAN function is in radians.
Reference: Roszman, L., NIST (19??). Reference: Roszman, L., NIST (19??).
Quantum Defects for Sulfur I Atom. Quantum Defects for Sulfur I Atom.
@@ -38,7 +38,7 @@ Model: Miscellaneous Class
Starting Values Certified Values Starting Values Certified Values
Start 1 Start 2 Parameter Standard Deviation Start 1 Start 2 Parameter Standard Deviation
b1 = 0.1 0.2 2.0196866396E-01 1.9172666023E-02 b1 = 0.1 0.2 1.20196866396E-0 1.9172666023E-02
b2 = -0.00001 -0.000005 -6.1953516256E-06 3.2058931691E-06 b2 = -0.00001 -0.000005 -6.1953516256E-06 3.2058931691E-06
b3 = 1000 1200 1.2044556708E+03 7.4050983057E+01 b3 = 1000 1200 1.2044556708E+03 7.4050983057E+01
b4 = -100 -150 -1.8134269537E+02 4.9573513849E+01 b4 = -100 -150 -1.8134269537E+02 4.9573513849E+01
+53 -15
View File
@@ -363,24 +363,29 @@ int RegressionDriver(const std::string& filename,
double certified_cost = summaries[nist_problem.num_starts()].initial_cost; double certified_cost = summaries[nist_problem.num_starts()].initial_cost;
int num_success = 0; int num_success = 0;
const int kMinNumMatchingDigits = 4;
for (int start = 0; start < nist_problem.num_starts(); ++start) { for (int start = 0; start < nist_problem.num_starts(); ++start) {
const ceres::Solver::Summary& summary = summaries[start]; const ceres::Solver::Summary& summary = summaries[start];
const int num_matching_digits =
-std::log10(1e-18 + int num_matching_digits = 0;
fabs(summary.final_cost - certified_cost) if (summary.final_cost < certified_cost) {
/ certified_cost); num_matching_digits = kMinNumMatchingDigits + 1;
std::cerr << "start " << start + 1 << " " ;
if (num_matching_digits > 4) {
++num_success;
std::cerr << "SUCCESS";
} else { } else {
std::cerr << "FAILURE"; num_matching_digits =
-std::log10(fabs(summary.final_cost - certified_cost) / certified_cost);
}
if (num_matching_digits <= kMinNumMatchingDigits) {
std::cerr << "start " << start + 1 << " " ;
std::cerr << "FAILURE";
std::cerr << " summary: "
<< summary.BriefReport()
<< std::endl;
} else {
++num_success;
} }
std::cerr << " digits: " << num_matching_digits;
std::cerr << " summary: "
<< summary.BriefReport()
<< std::endl;
} }
return num_success; return num_success;
} }
@@ -436,12 +441,45 @@ int main(int argc, char** argv) {
// TODO(sameeragarwal): Test more combinations of non-linear and // TODO(sameeragarwal): Test more combinations of non-linear and
// linear solvers. // linear solvers.
ceres::Solver::Options options; ceres::Solver::Options options;
options.linear_solver_type = ceres::DENSE_QR; options.max_num_iterations = 10000;
options.max_num_iterations = 2000;
options.function_tolerance *= 1e-10; options.function_tolerance *= 1e-10;
options.gradient_tolerance *= 1e-10; options.gradient_tolerance *= 1e-10;
options.parameter_tolerance *= 1e-10; options.parameter_tolerance *= 1e-10;
options.linear_solver_type = ceres::DENSE_QR;
options.trust_region_strategy_type = ceres::LEVENBERG_MARQUARDT;
std::cerr << "Levenberg-Marquardt - DENSE_QR\n";
SolveNISTProblems(options);
options.trust_region_strategy_type = ceres::DOGLEG;
options.dogleg_type = ceres::TRADITIONAL_DOGLEG;
std::cerr << "\n\nTraditional Dogleg - DENSE_QR\n\n";
SolveNISTProblems(options);
options.trust_region_strategy_type = ceres::DOGLEG;
options.dogleg_type = ceres::SUBSPACE_DOGLEG;
std::cerr << "\n\nSubspace Dogleg - DENSE_QR\n\n";
SolveNISTProblems(options);
options.linear_solver_type = ceres::DENSE_NORMAL_CHOLESKY;
options.trust_region_strategy_type = ceres::LEVENBERG_MARQUARDT;
std::cerr << "Levenberg-Marquardt - DENSE_NORMAL_CHOLESKY\n";
SolveNISTProblems(options);
options.trust_region_strategy_type = ceres::DOGLEG;
options.dogleg_type = ceres::TRADITIONAL_DOGLEG;
std::cerr << "\n\nTraditional Dogleg - DENSE_NORMAL_CHOLESKY\n\n";
SolveNISTProblems(options);
options.trust_region_strategy_type = ceres::DOGLEG;
options.dogleg_type = ceres::SUBSPACE_DOGLEG;
std::cerr << "\n\nSubspace Dogleg - DENSE_NORMAL_CHOLESKY\n\n";
SolveNISTProblems(options);
options.linear_solver_type = ceres::CGNR;
options.preconditioner_type = ceres::JACOBI;
options.trust_region_strategy_type = ceres::LEVENBERG_MARQUARDT;
std::cerr << "Levenberg-Marquardt - CGNR + JACOBI\n";
SolveNISTProblems(options); SolveNISTProblems(options);
return 0; return 0;