BubbleProfiler
0.3.0
by Peter Athron, Csaba Balazs, Michael Bardsley, Andrew Fowlie, Dylan Harries & Graham White
|
#include <nlopt_optimizer.hpp>
Public Types | |
enum | Extremum_type { Extremum_type::MIN, Extremum_type::MAX } |
using | Index = Eigen::VectorXd::Index |
using | Function = std::function< double(const Eigen::VectorXd &)> |
Public Member Functions | |
NLopt_optimizer (Index) | |
template<typename F > | |
NLopt_optimizer (F &&, Index) | |
void | set_algorithm (nlopt::algorithm a) |
void | set_extremum_type (Extremum_type e) |
template<typename F > | |
void | set_function (F &&f) |
void | set_lower_bounds (double lb) |
void | set_lower_bounds (Index i, double lb) |
void | set_lower_bounds (const Eigen::VectorXd &lb) |
void | set_upper_bounds (double ub) |
void | set_upper_bounds (Index i, double ub) |
void | set_upper_bounds (const Eigen::VectorXd &ub) |
void | set_xtol_rel (double xtol_rel_) |
void | set_ftol_rel (double ftol_rel_) |
void | set_max_time (double maxtime) |
Eigen::VectorXd | get_extremum_location () const |
double | get_extremum_value () const |
nlopt::result | optimize (const Eigen::VectorXd &guess) |
Static Private Member Functions | |
static double | nlopt_function (const std::vector< double > &, std::vector< double > &, void *) |
Private Attributes | |
Index | n_dims {} |
nlopt::algorithm | algorithm {nlopt::GN_DIRECT_L} |
Extremum_type | extremum_type {Extremum_type::MIN} |
Eigen::VectorXd | lower_bounds {} |
Eigen::VectorXd | upper_bounds {} |
double | maxtime {0.} |
Eigen::VectorXd | extremum {} |
double | extremum_value {0.} |
Function | function {nullptr} |
double | xtol_rel {2. * std::numeric_limits<double>::epsilon()} |
double | ftol_rel {2. * std::numeric_limits<double>::epsilon()} |
Lightweight wrapper class for the NLOpt numerical optimization library.
Definition at line 35 of file nlopt_optimizer.hpp.
using BubbleProfiler::NLopt_optimizer::Function = std::function<double(const Eigen::VectorXd&)> |
Definition at line 38 of file nlopt_optimizer.hpp.
using BubbleProfiler::NLopt_optimizer::Index = Eigen::VectorXd::Index |
Definition at line 37 of file nlopt_optimizer.hpp.
|
strong |
Enumerator | |
---|---|
MIN | |
MAX |
Definition at line 40 of file nlopt_optimizer.hpp.
|
explicit |
Definition at line 50 of file nlopt_optimizer.cpp.
BubbleProfiler::NLopt_optimizer::NLopt_optimizer | ( | F && | f, |
Index | n | ||
) |
Definition at line 97 of file nlopt_optimizer.hpp.
|
inline |
Definition at line 69 of file nlopt_optimizer.hpp.
References extremum.
Referenced by BubbleProfiler::find_global_min(), and BubbleProfiler::find_one_dimensional_barrier().
|
inline |
Definition at line 70 of file nlopt_optimizer.hpp.
References extremum_value, and optimize().
|
staticprivate |
Definition at line 165 of file nlopt_optimizer.cpp.
Referenced by optimize().
nlopt::result BubbleProfiler::NLopt_optimizer::optimize | ( | const Eigen::VectorXd & | guess | ) |
Run the optimizer with configured parameters.
guess | Vector in which result will be stored |
Definition at line 122 of file nlopt_optimizer.cpp.
References algorithm, extremum, extremum_type, extremum_value, ftol_rel, lower_bounds, maxtime, MIN, n_dims, nlopt_function(), upper_bounds, and xtol_rel.
Referenced by BubbleProfiler::find_global_min(), BubbleProfiler::find_one_dimensional_barrier(), and get_extremum_value().
|
inline |
Definition at line 46 of file nlopt_optimizer.hpp.
References algorithm.
|
inline |
Definition at line 47 of file nlopt_optimizer.hpp.
References extremum_type.
Referenced by BubbleProfiler::find_global_min(), and BubbleProfiler::find_one_dimensional_barrier().
void BubbleProfiler::NLopt_optimizer::set_ftol_rel | ( | double | ftol_rel_ | ) |
Definition at line 62 of file nlopt_optimizer.cpp.
References ftol_rel.
Referenced by BubbleProfiler::find_one_dimensional_barrier(), and set_function().
|
inline |
Definition at line 49 of file nlopt_optimizer.hpp.
References maxtime, set_ftol_rel(), set_lower_bounds(), set_max_time(), set_upper_bounds(), and set_xtol_rel().
void BubbleProfiler::NLopt_optimizer::set_lower_bounds | ( | double | lb | ) |
Definition at line 67 of file nlopt_optimizer.cpp.
References lower_bounds, and n_dims.
Referenced by BubbleProfiler::find_global_min(), BubbleProfiler::find_one_dimensional_barrier(), and set_function().
void BubbleProfiler::NLopt_optimizer::set_lower_bounds | ( | Index | i, |
double | lb | ||
) |
Definition at line 72 of file nlopt_optimizer.cpp.
References lower_bounds, and n_dims.
void BubbleProfiler::NLopt_optimizer::set_lower_bounds | ( | const Eigen::VectorXd & | lb | ) |
Definition at line 81 of file nlopt_optimizer.cpp.
References lower_bounds.
void BubbleProfiler::NLopt_optimizer::set_max_time | ( | double | maxtime | ) |
Set a timeout for the optimizer. Failure to converge before timeout is considered an error, and an exception will be thrown. If this parameter is set to zero (the default value), no timeout is applied.
maxtime | maximum runtime (seconds) |
Definition at line 113 of file nlopt_optimizer.cpp.
References maxtime.
Referenced by BubbleProfiler::find_global_min(), BubbleProfiler::find_one_dimensional_barrier(), and set_function().
void BubbleProfiler::NLopt_optimizer::set_upper_bounds | ( | double | ub | ) |
Definition at line 90 of file nlopt_optimizer.cpp.
References n_dims, and upper_bounds.
Referenced by BubbleProfiler::find_global_min(), BubbleProfiler::find_one_dimensional_barrier(), and set_function().
void BubbleProfiler::NLopt_optimizer::set_upper_bounds | ( | Index | i, |
double | ub | ||
) |
Definition at line 95 of file nlopt_optimizer.cpp.
References n_dims, and upper_bounds.
void BubbleProfiler::NLopt_optimizer::set_upper_bounds | ( | const Eigen::VectorXd & | ub | ) |
Definition at line 104 of file nlopt_optimizer.cpp.
References upper_bounds.
void BubbleProfiler::NLopt_optimizer::set_xtol_rel | ( | double | xtol_rel_ | ) |
Definition at line 57 of file nlopt_optimizer.cpp.
References xtol_rel.
Referenced by BubbleProfiler::find_one_dimensional_barrier(), and set_function().
|
private |
Definition at line 81 of file nlopt_optimizer.hpp.
Referenced by optimize(), and set_algorithm().
|
private |
Definition at line 86 of file nlopt_optimizer.hpp.
Referenced by get_extremum_location(), and optimize().
|
private |
Definition at line 82 of file nlopt_optimizer.hpp.
Referenced by optimize(), and set_extremum_type().
|
private |
Definition at line 87 of file nlopt_optimizer.hpp.
Referenced by get_extremum_value(), and optimize().
|
private |
Definition at line 90 of file nlopt_optimizer.hpp.
Referenced by optimize(), and set_ftol_rel().
|
private |
Definition at line 88 of file nlopt_optimizer.hpp.
|
private |
Definition at line 83 of file nlopt_optimizer.hpp.
Referenced by optimize(), and set_lower_bounds().
|
private |
Definition at line 85 of file nlopt_optimizer.hpp.
Referenced by optimize(), set_function(), and set_max_time().
|
private |
Definition at line 80 of file nlopt_optimizer.hpp.
Referenced by optimize(), set_lower_bounds(), and set_upper_bounds().
|
private |
Definition at line 84 of file nlopt_optimizer.hpp.
Referenced by optimize(), and set_upper_bounds().
|
private |
Definition at line 89 of file nlopt_optimizer.hpp.
Referenced by optimize(), and set_xtol_rel().