| 267 | } |
| 268 | |
| 269 | void SetMinimizerOptions(Solver::Options* options) { |
| 270 | options->max_num_iterations = CERES_GET_FLAG(FLAGS_num_iterations); |
| 271 | options->minimizer_progress_to_stdout = true; |
| 272 | if (CERES_GET_FLAG(FLAGS_num_threads) == -1) { |
| 273 | const int num_available_threads = |
| 274 | static_cast<int>(std::thread::hardware_concurrency()); |
| 275 | if (num_available_threads > 0) { |
| 276 | options->num_threads = num_available_threads; |
| 277 | } |
| 278 | } else { |
| 279 | options->num_threads = CERES_GET_FLAG(FLAGS_num_threads); |
| 280 | } |
| 281 | CHECK_GE(options->num_threads, 1); |
| 282 | |
| 283 | options->eta = CERES_GET_FLAG(FLAGS_eta); |
| 284 | options->max_solver_time_in_seconds = CERES_GET_FLAG(FLAGS_max_solver_time); |
| 285 | options->use_nonmonotonic_steps = CERES_GET_FLAG(FLAGS_nonmonotonic_steps); |
| 286 | if (CERES_GET_FLAG(FLAGS_line_search)) { |
| 287 | options->minimizer_type = ceres::LINE_SEARCH; |
| 288 | } |
| 289 | |
| 290 | CHECK(StringToTrustRegionStrategyType( |
| 291 | CERES_GET_FLAG(FLAGS_trust_region_strategy), |
| 292 | &options->trust_region_strategy_type)); |
| 293 | CHECK( |
| 294 | StringToDoglegType(CERES_GET_FLAG(FLAGS_dogleg), &options->dogleg_type)); |
| 295 | options->use_inner_iterations = CERES_GET_FLAG(FLAGS_inner_iterations); |
| 296 | } |
| 297 | |
| 298 | void SetSolverOptionsFromFlags(BALProblem* bal_problem, |
| 299 | Solver::Options* options) { |
no test coverage detected