123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- #ifndef CERES_PUBLIC_GRADIENT_PROBLEM_SOLVER_H_
- #define CERES_PUBLIC_GRADIENT_PROBLEM_SOLVER_H_
- #include <cmath>
- #include <string>
- #include <vector>
- #include "ceres/internal/disable_warnings.h"
- #include "ceres/internal/export.h"
- #include "ceres/internal/port.h"
- #include "ceres/iteration_callback.h"
- #include "ceres/types.h"
- namespace ceres {
- class GradientProblem;
- class CERES_EXPORT GradientProblemSolver {
- public:
- virtual ~GradientProblemSolver();
-
-
-
-
-
- struct CERES_EXPORT Options {
-
-
-
- bool IsValid(std::string* error) const;
-
- LineSearchDirectionType line_search_direction_type = LBFGS;
- LineSearchType line_search_type = WOLFE;
- NonlinearConjugateGradientType nonlinear_conjugate_gradient_type =
- FLETCHER_REEVES;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- int max_lbfgs_rank = 20;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- bool use_approximate_eigenvalue_bfgs_scaling = false;
-
-
-
-
-
- LineSearchInterpolationType line_search_interpolation_type = CUBIC;
-
-
- double min_line_search_step_size = 1e-9;
-
-
-
-
-
-
-
-
-
-
-
- double line_search_sufficient_function_decrease = 1e-4;
-
-
-
-
-
-
-
-
- double max_line_search_step_contraction = 1e-3;
-
-
-
-
-
-
-
-
- double min_line_search_step_contraction = 0.6;
-
-
-
- int max_num_line_search_step_size_iterations = 20;
-
-
-
-
-
- int max_num_line_search_direction_restarts = 5;
-
-
-
-
-
-
-
-
-
-
-
- double line_search_sufficient_curvature_decrease = 0.9;
-
-
-
-
-
-
-
-
-
- double max_line_search_step_expansion = 10.0;
-
- int max_num_iterations = 50;
-
- double max_solver_time_in_seconds = 1e9;
-
-
-
-
- double function_tolerance = 1e-6;
-
-
-
-
-
- double gradient_tolerance = 1e-10;
-
-
-
-
- double parameter_tolerance = 1e-8;
-
- LoggingType logging_type = PER_MINIMIZER_ITERATION;
-
-
-
-
- bool minimizer_progress_to_stdout = false;
-
-
-
-
-
- bool update_state_every_iteration = false;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- std::vector<IterationCallback*> callbacks;
- };
- struct CERES_EXPORT Summary {
-
-
- std::string BriefReport() const;
-
-
- std::string FullReport() const;
- bool IsSolutionUsable() const;
-
- TerminationType termination_type = FAILURE;
-
- std::string message = "ceres::GradientProblemSolve was not called.";
-
-
- double initial_cost = -1.0;
-
-
- double final_cost = -1.0;
-
- std::vector<IterationSummary> iterations;
-
- int num_cost_evaluations = -1;
-
- int num_gradient_evaluations = -1;
-
- double total_time_in_seconds = -1.0;
-
- double cost_evaluation_time_in_seconds = -1.0;
-
- double gradient_evaluation_time_in_seconds = -1.0;
-
-
- double line_search_polynomial_minimization_time_in_seconds = -1.0;
-
- int num_parameters = -1;
-
- int num_tangent_parameters = -1;
-
- LineSearchDirectionType line_search_direction_type = LBFGS;
-
- LineSearchType line_search_type = WOLFE;
-
-
- LineSearchInterpolationType line_search_interpolation_type = CUBIC;
-
-
-
- NonlinearConjugateGradientType nonlinear_conjugate_gradient_type =
- FLETCHER_REEVES;
-
-
- int max_lbfgs_rank = -1;
- };
-
-
-
-
-
- virtual void Solve(const GradientProblemSolver::Options& options,
- const GradientProblem& problem,
- double* parameters,
- GradientProblemSolver::Summary* summary);
- };
- CERES_EXPORT void Solve(const GradientProblemSolver::Options& options,
- const GradientProblem& problem,
- double* parameters,
- GradientProblemSolver::Summary* summary);
- }
- #include "ceres/internal/reenable_warnings.h"
- #endif
|