123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- #ifndef CERES_INTERNAL_TRUST_REGION_STRATEGY_H_
- #define CERES_INTERNAL_TRUST_REGION_STRATEGY_H_
- #include <memory>
- #include <string>
- #include "ceres/internal/disable_warnings.h"
- #include "ceres/internal/export.h"
- #include "ceres/linear_solver.h"
- namespace ceres::internal {
- class LinearSolver;
- class SparseMatrix;
- class CERES_NO_EXPORT TrustRegionStrategy {
- public:
- struct Options {
- TrustRegionStrategyType trust_region_strategy_type = LEVENBERG_MARQUARDT;
-
- LinearSolver* linear_solver = nullptr;
- double initial_radius = 1e4;
- double max_radius = 1e32;
-
-
-
-
- double min_lm_diagonal = 1e-6;
- double max_lm_diagonal = 1e32;
-
- DoglegType dogleg_type = TRADITIONAL_DOGLEG;
- ContextImpl* context = nullptr;
- int num_threads = 1;
- };
-
- static std::unique_ptr<TrustRegionStrategy> Create(const Options& options);
- virtual ~TrustRegionStrategy();
-
- struct PerSolveOptions {
-
- double eta = 1e-1;
- DumpFormatType dump_format_type = TEXTFILE;
-
-
-
-
-
- std::string dump_filename_base;
- };
- struct Summary {
-
-
-
-
-
-
-
- double residual_norm = -1;
-
-
-
- int num_iterations = -1;
-
- LinearSolverTerminationType termination_type =
- LinearSolverTerminationType::FAILURE;
- };
-
- virtual Summary ComputeStep(const PerSolveOptions& per_solve_options,
- SparseMatrix* jacobian,
- const double* residuals,
- double* step) = 0;
-
-
-
- virtual void StepAccepted(double step_quality) = 0;
-
-
-
- virtual void StepRejected(double step_quality) = 0;
-
-
-
-
- virtual void StepIsInvalid() = 0;
-
- virtual double Radius() const = 0;
- };
- }
- #include "ceres/internal/reenable_warnings.h"
- #endif
|