|
MiniTensor Version of the Day
|
Nonlinear system solvers, unconstrained and constrained optimization methods, and benchmark test functions. More...
Typedefs | |
| template<typename T , int N> | |
| using | minitensor::FAD = Sacado::Fad::SLFad< T, N > |
| The Fad type to use. | |
Enumerations | |
| enum class | minitensor::StepType { minitensor::StepType::UNDEFINED = 0 , minitensor::StepType::NEWTON = 1 , minitensor::StepType::NEWTON_LS = 2 , minitensor::StepType::TRUST_REGION = 3 , minitensor::StepType::CG = 4 , minitensor::StepType::LINE_SEARCH_REG = 5 } |
Nonlinear system solvers, unconstrained and constrained optimization methods, and benchmark test functions.
| using minitensor::FAD = typedef Sacado::Fad::SLFad<T, N> |
The Fad type to use.
Definition at line 27 of file MiniTensor_Solvers.h.
|
strong |
The step types
| Enumerator | |
|---|---|
| UNDEFINED | |
| NEWTON | |
| NEWTON_LS | |
| TRUST_REGION | |
| CG | |
| LINE_SEARCH_REG | |
Definition at line 728 of file MiniTensor_Solvers.h.
|
inline |
Definition at line 46 of file MiniTensor_Solvers.h.
| T minitensor::Function_Base< FunctionDerived, S, M >::value | ( | FunctionDerived & | f, |
| Vector< T, N > const & | x | ||
| ) |
By default use merit function 0.5 dot(residual,residual) as the target to optimize if only the residual is provided.
Definition at line 1038 of file MiniTensor_Solvers.h.
| Vector< T, N > minitensor::Function_Base< FunctionDerived, S, M >::gradient | ( | FunctionDerived & | f, |
| Vector< T, N > const & | x | ||
| ) |
By default compute gradient with AD from value().
Definition at line 1055 of file MiniTensor_Solvers.h.
| Vector< T, N > minitensor::Function_Base< FunctionDerived, S, M >::residual | ( | FunctionDerived & | f, |
| Vector< T, N > const & | x | ||
| ) |
Defined explicitly.
Definition at line 1091 of file MiniTensor_Solvers.h.
| Tensor< T, N > minitensor::Function_Base< FunctionDerived, S, M >::hessian | ( | FunctionDerived & | f, |
| Vector< T, N > const & | x | ||
| ) |
By default compute Hessian with AD from gradient().
Definition at line 1103 of file MiniTensor_Solvers.h.
| void minitensor::Function_Base< FunctionDerived, S, M >::set_failed | ( | char const *const | msg = nullptr | ) |
Mark the function as failed and optionally set a failure message.
Definition at line 1140 of file MiniTensor_Solvers.h.
| bool minitensor::Function_Base< FunctionDerived, S, M >::get_failed | ( | ) |
Return whether the function has failed.
Definition at line 1153 of file MiniTensor_Solvers.h.
| void minitensor::Function_Base< FunctionDerived, S, M >::clear_failed | ( | ) |
Clear the failure flag.
Definition at line 1164 of file MiniTensor_Solvers.h.
| void minitensor::Function_Base< FunctionDerived, S, M >::set_failure_message | ( | char const *const | msg = nullptr | ) |
Set the failure message.
Definition at line 1176 of file MiniTensor_Solvers.h.
| char const * minitensor::Function_Base< FunctionDerived, S, M >::get_failure_message | ( | ) |
Return the failure message.
Definition at line 1188 of file MiniTensor_Solvers.h.
|
inline |
Definition at line 130 of file MiniTensor_Solvers.h.
| Vector< T, NC > minitensor::Equality_Constraint< ConstraintDerived, S, NC, NV >::value | ( | ConstraintDerived & | c, |
| Vector< T, N > const & | x | ||
| ) |
Return the value of the constraints at point x.
Definition at line 1200 of file MiniTensor_Solvers.h.
| Matrix< T, NC, NV > minitensor::Equality_Constraint< ConstraintDerived, S, NC, NV >::gradient | ( | ConstraintDerived & | c, |
| Vector< T, N > const & | x | ||
| ) |
By default compute gradient with AD from value().
Definition at line 1213 of file MiniTensor_Solvers.h.
| minitensor::Bounds< T, N >::Bounds | ( | Vector< T, N > const & | l, |
| Vector< T, N > const & | u | ||
| ) |
Construct bounds from lower bound l and upper bound u.
Definition at line 1252 of file MiniTensor_Solvers.h.
| minitensor::Minimizer< T, N >::Minimizer | ( | ) |
Definition at line 1262 of file MiniTensor_Solvers.h.
| void minitensor::Minimizer< T, N >::solve | ( | STEP & | step_method, |
| FN & | fn, | ||
| Vector< T, N > & | x | ||
| ) |
Minimize the function fn starting from x using the given step method. On return x contains the solution found.
Definition at line 1279 of file MiniTensor_Solvers.h.
| void minitensor::Minimizer< T, N >::printReport | ( | std::ostream & | os | ) |
Print a summary report of the minimization to the stream os.
Definition at line 1336 of file MiniTensor_Solvers.h.
|
private |
Update the absolute and relative errors and the convergence status.
Definition at line 1376 of file MiniTensor_Solvers.h.
|
private |
Update the monotonicity, stagnation and boundedness status with the latest function value.
Definition at line 1407 of file MiniTensor_Solvers.h.
|
private |
Return whether the iteration loop should continue.
Definition at line 1451 of file MiniTensor_Solvers.h.
|
private |
Record the final solution, function value, gradient and Hessian.
Definition at line 1490 of file MiniTensor_Solvers.h.
| Vector< T, N > minitensor::NewtonLineSearch< T, N >::step | ( | FN & | fn, |
| Vector< T, N > const & | direction, | ||
| Vector< T, N > const & | soln | ||
| ) |
Perform a Newton line search from soln along direction and return the resulting step.
Definition at line 1755 of file MiniTensor_Solvers.h.
| Vector< T, N > minitensor::BacktrackingLineSearch< T, N >::step | ( | FN & | fn, |
| Vector< T, N > const & | direction, | ||
| Vector< T, N > const & | soln | ||
| ) |
Perform a back-tracking line search from soln along direction and return the resulting step.
Definition at line 1809 of file MiniTensor_Solvers.h.
| Vector< T, N > minitensor::TrustRegionSubproblemBase< T, N >::lin_solve | ( | Tensor< T, N > const & | A, |
| Vector< T, N > const & | b | ||
| ) |
Solve the linear system \( A x = b \) with preconditioning.
Definition at line 1515 of file MiniTensor_Solvers.h.
| Vector< T, N > minitensor::TrustRegionExactValue< T, N >::step | ( | Tensor< T, N > const & | Hessian, |
| Vector< T, N > const & | gradient | ||
| ) |
Compute the trust-region step for the given Hessian and gradient.
Definition at line 1527 of file MiniTensor_Solvers.h.
| Vector< T, N > minitensor::TrustRegionExactGradient< T, N >::step | ( | Tensor< T, N > const & | Hessian, |
| Vector< T, N > const & | gradient | ||
| ) |
Compute the trust-region step for the given Hessian and gradient.
Definition at line 1591 of file MiniTensor_Solvers.h.
| Vector< T, N > minitensor::TrustRegionDogLegValue< T, N >::step | ( | Tensor< T, N > const & | Hessian, |
| Vector< T, N > const & | gradient | ||
| ) |
Compute the dog-leg step for the given Hessian and gradient.
Definition at line 1662 of file MiniTensor_Solvers.h.
| Vector< T, N > minitensor::TrustRegionDogLegGradient< T, N >::step | ( | Tensor< T, N > const & | Hessian, |
| Vector< T, N > const & | gradient | ||
| ) |
Compute the dog-leg step for the given Hessian and gradient.
Definition at line 1706 of file MiniTensor_Solvers.h.
|
inline |
Definition at line 677 of file MiniTensor_Solvers.h.
|
pure virtual |
Return the name of the step method.
Implemented in minitensor::NewtonStep< FN, T, N >, minitensor::NewtonWithLineSearchStep< FN, T, N >, minitensor::TrustRegionStep< FN, T, N >, minitensor::ConjugateGradientStep< FN, T, N >, and minitensor::LineSearchRegularizedStep< FN, T, N >.
|
pure virtual |
Initialize the step method with function fn, initial guess x and residual r.
Implemented in minitensor::NewtonStep< FN, T, N >, minitensor::NewtonWithLineSearchStep< FN, T, N >, minitensor::TrustRegionStep< FN, T, N >, minitensor::ConjugateGradientStep< FN, T, N >, and minitensor::LineSearchRegularizedStep< FN, T, N >.
|
pure virtual |
Compute a step for function fn at point x with residual r.
Implemented in minitensor::NewtonStep< FN, T, N >, minitensor::NewtonWithLineSearchStep< FN, T, N >, minitensor::TrustRegionStep< FN, T, N >, minitensor::ConjugateGradientStep< FN, T, N >, and minitensor::LineSearchRegularizedStep< FN, T, N >.
|
inlinevirtual |
Definition at line 709 of file MiniTensor_Solvers.h.
| Vector< T, N > minitensor::StepBase< FN, T, N >::lin_solve | ( | Tensor< T, N > const & | A, |
| Vector< T, N > const & | b | ||
| ) |
Solve the linear system \( A x = b \) with preconditioning.
Definition at line 1504 of file MiniTensor_Solvers.h.
| std::unique_ptr< StepBase< FN, T, N > > minitensor::stepFactory | ( | StepType | step_type | ) |
Construct the step object for the given step type.
Definition at line 2194 of file MiniTensor_Solvers.h.
|
inlinevirtual |
Return the name of the step method.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 763 of file MiniTensor_Solvers.h.
|
virtual |
Initialize the step method.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 1894 of file MiniTensor_Solvers.h.
|
virtual |
Compute a full Newton step.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 1905 of file MiniTensor_Solvers.h.
|
inlinevirtual |
Definition at line 783 of file MiniTensor_Solvers.h.
|
inlinevirtual |
Return the name of the step method.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 805 of file MiniTensor_Solvers.h.
|
virtual |
Initialize the step method.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 1923 of file MiniTensor_Solvers.h.
|
virtual |
Compute a Newton step followed by a back-tracking line search.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 1934 of file MiniTensor_Solvers.h.
|
inlinevirtual |
Definition at line 826 of file MiniTensor_Solvers.h.
|
inlinevirtual |
Return the name of the step method.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 847 of file MiniTensor_Solvers.h.
|
virtual |
Initialize the trust-region radius.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 1958 of file MiniTensor_Solvers.h.
|
virtual |
Compute a trust-region step. See Nocedal 2nd Ed, algorithm 11.5.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 1971 of file MiniTensor_Solvers.h.
|
inlinevirtual |
Definition at line 868 of file MiniTensor_Solvers.h.
|
inlinevirtual |
Return the name of the step method.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 914 of file MiniTensor_Solvers.h.
|
virtual |
Initialize the search direction and preconditioned residual.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 2046 of file MiniTensor_Solvers.h.
|
virtual |
Compute a preconditioned conjugate gradient step (Polak-Ribiere).
Implements minitensor::StepBase< FN, T, N >.
Definition at line 2072 of file MiniTensor_Solvers.h.
|
inlinevirtual |
Definition at line 936 of file MiniTensor_Solvers.h.
|
inlinevirtual |
Return the name of the step method.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 990 of file MiniTensor_Solvers.h.
|
virtual |
Initialize the step method.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 2134 of file MiniTensor_Solvers.h.
|
virtual |
Compute a regularized Newton step followed by a Newton line search. See Nocedal 2nd Ed, algorithm 11.4.
Implements minitensor::StepBase< FN, T, N >.
Definition at line 2145 of file MiniTensor_Solvers.h.
|
inlinevirtual |
Definition at line 1011 of file MiniTensor_Solvers.h.
|
staticconstexpr |
Maximum dimension of the argument vectors.
Definition at line 44 of file MiniTensor_Solvers.h.
|
protected |
Signal that something has gone horribly wrong.
Definition at line 115 of file MiniTensor_Solvers.h.
|
protected |
Keep a message to inform what went wrong above.
Definition at line 120 of file MiniTensor_Solvers.h.
|
staticconstexpr |
This is an equality constraint.
Definition at line 153 of file MiniTensor_Solvers.h.
| bool minitensor::Equality_Constraint< ConstraintDerived, S, NC, NV >::failed {false} |
Signal that something has gone horribly wrong.
Definition at line 159 of file MiniTensor_Solvers.h.
|
staticconstexpr |
Number of constraints.
Definition at line 166 of file MiniTensor_Solvers.h.
|
staticconstexpr |
Number of variables.
Definition at line 173 of file MiniTensor_Solvers.h.
|
staticconstexpr |
This is not an equality constraint.
Definition at line 188 of file MiniTensor_Solvers.h.
| Vector<T, N> minitensor::Bounds< T, N >::lower |
Lower bound.
Definition at line 206 of file MiniTensor_Solvers.h.
| Vector<T, N> minitensor::Bounds< T, N >::upper |
Upper bound.
Definition at line 212 of file MiniTensor_Solvers.h.
| Index minitensor::Minimizer< T, N >::max_num_iter {256} |
Maximum number of iterations allowed.
Definition at line 273 of file MiniTensor_Solvers.h.
| Index minitensor::Minimizer< T, N >::min_num_iter {0} |
Minimum number of iterations to perform.
Definition at line 279 of file MiniTensor_Solvers.h.
| Index minitensor::Minimizer< T, N >::num_iter {0} |
Number of iterations taken.
Definition at line 285 of file MiniTensor_Solvers.h.
| Index minitensor::Minimizer< T, N >::num_stagnation_iter {0} |
Number of consecutive stagnant iterations so far.
Definition at line 291 of file MiniTensor_Solvers.h.
| Index minitensor::Minimizer< T, N >::max_stagnation_iter {0} |
Maximum number of consecutive stagnant iterations allowed.
Definition at line 298 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::initial_norm {1.0} |
Norm of the initial residual, \( \|R_0\| \).
Definition at line 304 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::rel_tol {1.0e-12} |
Relative error tolerance.
Definition at line 310 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::rel_error {1.0} |
Current relative error, \( \|R\| / \|R_0\| \).
Definition at line 316 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::abs_tol {1.0e-12} |
Absolute error tolerance.
Definition at line 322 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::acc_tol {1.0e-12} |
Acceptable absolute tolerance applied at the last iteration.
Definition at line 329 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::stagnation_tol {1.0} |
Reduction ratio above which an iteration is considered stagnant.
Definition at line 336 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::abs_error {1.0} |
Current absolute error, \( \|R\| \).
Definition at line 342 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::growth_limit {1.0} |
Growth factor over the initial value beyond which the objective function is considered unbounded.
Definition at line 349 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::initial_value {0.0} |
Initial value of the objective function.
Definition at line 355 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::previous_value {0.0} |
Value of the objective function at the previous iteration.
Definition at line 362 of file MiniTensor_Solvers.h.
| T minitensor::Minimizer< T, N >::final_value {0.0} |
Final value of the objective function.
Definition at line 368 of file MiniTensor_Solvers.h.
| bool minitensor::Minimizer< T, N >::failed {false} |
Whether the minimization failed.
Definition at line 374 of file MiniTensor_Solvers.h.
| bool minitensor::Minimizer< T, N >::warning {false} |
Whether a warning was issued.
Definition at line 380 of file MiniTensor_Solvers.h.
| bool minitensor::Minimizer< T, N >::converged {false} |
Whether the minimization converged.
Definition at line 386 of file MiniTensor_Solvers.h.
| bool minitensor::Minimizer< T, N >::monotonic {true} |
Whether the objective function decreased monotonically.
Definition at line 392 of file MiniTensor_Solvers.h.
| bool minitensor::Minimizer< T, N >::bounded {true} |
Whether the objective function remained bounded.
Definition at line 398 of file MiniTensor_Solvers.h.
| bool minitensor::Minimizer< T, N >::non_stagnant {true} |
Whether the iteration remained non-stagnant.
Definition at line 404 of file MiniTensor_Solvers.h.
| bool minitensor::Minimizer< T, N >::enforce_monotonicity {false} |
If true, fail when the objective function is non-monotonic.
Definition at line 411 of file MiniTensor_Solvers.h.
| bool minitensor::Minimizer< T, N >::enforce_boundedness {false} |
If true, fail when the objective function grows unbounded.
Definition at line 418 of file MiniTensor_Solvers.h.
| bool minitensor::Minimizer< T, N >::enforce_non_stagnation {false} |
If true, warn when the residual stagnates.
Definition at line 424 of file MiniTensor_Solvers.h.
| Vector<T, N> minitensor::Minimizer< T, N >::initial_guess |
Initial guess.
Definition at line 430 of file MiniTensor_Solvers.h.
| Vector<T, N> minitensor::Minimizer< T, N >::final_soln |
Final solution.
Definition at line 436 of file MiniTensor_Solvers.h.
| Vector<T, N> minitensor::Minimizer< T, N >::final_gradient |
Gradient at the final solution.
Definition at line 442 of file MiniTensor_Solvers.h.
| Tensor<T, N> minitensor::Minimizer< T, N >::final_hessian |
Hessian at the final solution.
Definition at line 448 of file MiniTensor_Solvers.h.
| char const* minitensor::Minimizer< T, N >::step_method_name {nullptr} |
Name of the step method used.
Definition at line 454 of file MiniTensor_Solvers.h.
| char const* minitensor::Minimizer< T, N >::function_name {nullptr} |
Name of the function being minimized.
Definition at line 460 of file MiniTensor_Solvers.h.
| char const* minitensor::Minimizer< T, N >::failure_message {"No failure detected"} |
Message describing a failure, if any.
Definition at line 466 of file MiniTensor_Solvers.h.
| char const* minitensor::Minimizer< T, N >::warning_message {"No warning detected"} |
Message describing a warning, if any.
Definition at line 472 of file MiniTensor_Solvers.h.
| Index minitensor::NewtonLineSearch< T, N >::max_num_iter {16} |
Maximum number of line search iterations.
Definition at line 493 of file MiniTensor_Solvers.h.
| T minitensor::NewtonLineSearch< T, N >::tolerance {1.0e-6} |
Convergence tolerance on the step length.
Definition at line 499 of file MiniTensor_Solvers.h.
| Index minitensor::BacktrackingLineSearch< T, N >::max_num_iter {100} |
Maximum number of iterations.
Definition at line 520 of file MiniTensor_Solvers.h.
| Index minitensor::BacktrackingLineSearch< T, N >::max_line_iter {10} |
Maximum number of line iterations before increasing the search parameter.
Definition at line 527 of file MiniTensor_Solvers.h.
| T minitensor::BacktrackingLineSearch< T, N >::search_parameter {0.5} |
Sufficient-decrease parameter for the residual norm.
Definition at line 533 of file MiniTensor_Solvers.h.
| T minitensor::BacktrackingLineSearch< T, N >::search_increment {0.1} |
Increment applied to the search parameter when the line iterations are exhausted.
Definition at line 540 of file MiniTensor_Solvers.h.
| T minitensor::BacktrackingLineSearch< T, N >::alpha {1.0} |
Line search step length multiplier.
Definition at line 546 of file MiniTensor_Solvers.h.
| T minitensor::BacktrackingLineSearch< T, N >::tolerance {1.0e-6} |
Convergence tolerance.
Definition at line 552 of file MiniTensor_Solvers.h.
| PreconditionerType minitensor::TrustRegionSubproblemBase< T, N >::preconditioner_type {PreconditionerType::IDENTITY} |
Preconditioner used by the linear solver.
Definition at line 565 of file MiniTensor_Solvers.h.
| Index minitensor::TrustRegionExactValue< T, N >::max_num_iter {4} |
Maximum number of iterations for the subproblem.
Definition at line 593 of file MiniTensor_Solvers.h.
| T minitensor::TrustRegionExactValue< T, N >::region_size {1.0} |
Trust-region radius \( \Delta \).
Definition at line 599 of file MiniTensor_Solvers.h.
| Index minitensor::TrustRegionExactGradient< T, N >::max_num_iter {4} |
Maximum number of iterations for the subproblem.
Definition at line 620 of file MiniTensor_Solvers.h.
| T minitensor::TrustRegionExactGradient< T, N >::region_size {1.0} |
Trust-region radius \( \Delta \).
Definition at line 626 of file MiniTensor_Solvers.h.
| T minitensor::TrustRegionDogLegValue< T, N >::region_size {1.0} |
Trust-region radius \( \Delta \).
Definition at line 647 of file MiniTensor_Solvers.h.
| T minitensor::TrustRegionDogLegGradient< T, N >::region_size {1.0} |
Trust-region radius \( \Delta \).
Definition at line 668 of file MiniTensor_Solvers.h.
| PreconditionerType minitensor::StepBase< FN, T, N >::preconditioner_type {PreconditionerType::IDENTITY} |
Preconditioner used by the linear solver.
Definition at line 715 of file MiniTensor_Solvers.h.
|
staticconstexpr |
Name of the step method.
Definition at line 756 of file MiniTensor_Solvers.h.
|
staticconstexpr |
Name of the step method.
Definition at line 798 of file MiniTensor_Solvers.h.
|
staticconstexpr |
Name of the step method.
Definition at line 840 of file MiniTensor_Solvers.h.
| T minitensor::TrustRegionStep< FN, T, N >::max_region_size {10.0} |
Maximum trust-region radius.
Definition at line 874 of file MiniTensor_Solvers.h.
| T minitensor::TrustRegionStep< FN, T, N >::initial_region_size {10.0} |
Initial trust-region radius.
Definition at line 880 of file MiniTensor_Solvers.h.
| T minitensor::TrustRegionStep< FN, T, N >::min_reduction {0.0} |
Minimum reduction ratio to accept a step.
Definition at line 886 of file MiniTensor_Solvers.h.
|
private |
Current trust-region radius \( \Delta \).
Definition at line 893 of file MiniTensor_Solvers.h.
|
staticconstexpr |
Name of the step method.
Definition at line 907 of file MiniTensor_Solvers.h.
| Index minitensor::ConjugateGradientStep< FN, T, N >::restart_directions_interval {32} |
Number of iterations between restarts of the search directions.
Definition at line 943 of file MiniTensor_Solvers.h.
|
private |
Current search direction.
Definition at line 950 of file MiniTensor_Solvers.h.
|
private |
Preconditioned residual.
Definition at line 956 of file MiniTensor_Solvers.h.
|
private |
Latest projection used by the Polak-Ribiere formula.
Definition at line 962 of file MiniTensor_Solvers.h.
|
private |
Iterations since the last restart of the search directions.
Definition at line 969 of file MiniTensor_Solvers.h.
|
staticconstexpr |
Name of the step method.
Definition at line 983 of file MiniTensor_Solvers.h.
| T minitensor::LineSearchRegularizedStep< FN, T, N >::step_length {1.0} |
Trust-region size used to regularize a bad Hessian.
Definition at line 1017 of file MiniTensor_Solvers.h.
| T minitensor::LineSearchRegularizedStep< FN, T, N >::hessian_cond_tol {1.0e+08} |
Hessian condition number above which regularization is applied.
Definition at line 1024 of file MiniTensor_Solvers.h.