🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ast::BrentOptimizer类 参考

#include <BrentOptimizer.hpp>

+ 类 ast::BrentOptimizer 继承关系图:

Public 成员函数

errc_t solve (UnaryScalarFunc &func, double min, double max, double &result, double *funcValue=nullptr) override
 
 UnaryOptimizer ()
 
 UnaryOptimizer (double relTol, double absTol, int maxIter)
 
 UnaryOptimizer (double absTol)
 
template<typename Func >
std::enable_if<!std::is_base_of< UnaryScalarFunc, typenamestd::remove_pointer< Func >::type >::value, errc_t >::type solve (Func func, double min, double max, double &result, double *funcValue=nullptr)
 
- Public 成员函数 继承自 ast::UnaryOptimizer
 UnaryOptimizer (double relTol, double absTol, int maxIter)
 
 UnaryOptimizer (double absTol)
 
double getRelTol () const
 
double getAbsTol () const
 
int getMaxIter () const
 
void setRelTol (double relTol)
 
void setAbsTol (double absTol)
 
void setMaxIter (int maxIter)
 
const SolverStatsgetStats () const
 
template<typename Func >
std::enable_if<!std::is_base_of< UnaryScalarFunc, typenamestd::remove_pointer< Func >::type >::value, errc_t >::type solve (Func func, double min, double max, double &result, double *funcValue=nullptr)
 
virtual errc_t solve (UnaryScalarFunc &func, double min, double max, double &result, double *funcValue=nullptr)=0
 
- Public 成员函数 继承自 ast::IUnaryOptimizer

额外继承的成员函数

- Protected 属性 继承自 ast::UnaryOptimizer
double relTol_
 
double absTol_
 
int maxIter_
 
SolverStats stats_ {}
 

详细描述

Brent法求解器

在单峰区间 [min, max] 内寻找一元函数的极小值点, 结合反抛物线插值与黄金分割搜索,收敛速度快于黄金分割法

成员函数说明

◆ solve() [1/2]

template<typename Func >
std::enable_if<!std::is_base_of< UnaryScalarFunc, typenamestd::remove_pointer< Func >::type >::value, errc_t >::type ast::UnaryOptimizer::solve ( Func func,
double min,
double max,
double & result,
double * funcValue = nullptr )
inline

求解一元函数极小值点(支持lambda函数)

模板参数
Funclambda或可调用对象类型
参数
funclambda函数
min搜索下限
max搜索上限
result输出极小值点横坐标
funcValue输出极小值点处的函数值(可为空)

◆ solve() [2/2]

errc_t ast::BrentOptimizer::solve ( UnaryScalarFunc & func,
double min,
double max,
double & result,
double * funcValue = nullptr )
overridevirtual

求解一元函数在区间内的极小值点

参数
func目标函数
min搜索下限
max搜索上限
result输出极小值点横坐标
funcValue输出极小值点处的函数值(可为空)

< 上一步移动距离

< 当前步长

实现了 ast::IUnaryOptimizer.

◆ UnaryOptimizer() [1/2]

ast::UnaryOptimizer::UnaryOptimizer ( double absTol)
explicit

构造函数

参数
absTol绝对误差容限

◆ UnaryOptimizer() [2/2]

ast::UnaryOptimizer::UnaryOptimizer ( double relTol,
double absTol,
int maxIter )

构造函数

参数
relTol相对误差容限
absTol绝对误差容限
maxIter最大迭代次数

该类的文档由以下文件生成: