27 #include "base_nlopt.h"
28 #include "nlopt_aug_lag.h"
30 namespace pagmo {
namespace algorithm {
48 nlopt_aug_lag::nlopt_aug_lag(
int aux_algo_id,
int max_iter,
const double &ftol,
const double &xtol,
int aux_max_iter,
const double &aux_ftol,
const double &aux_xtol):
base_nlopt(nlopt::AUGLAG,true,false,max_iter,ftol,xtol), m_aux_algo_id(aux_algo_id), m_aux_max_iter(aux_max_iter), m_aux_ftol(aux_ftol), m_aux_xtol(aux_xtol) {
49 if ( (aux_ftol <= 0) || (aux_xtol <= 0) ) {
50 pagmo_throw(value_error,
"tolerances for the local optimizer must be positive");
52 if ((aux_algo_id >4)||(aux_algo_id<1)) {
53 pagmo_throw(value_error,
"local algorithm id must be one of 1.2.3.4");
64 nlopt::opt aux_opt(nlopt::LN_SBPLX,1);
68 aux_opt = nlopt::opt(nlopt::LN_SBPLX,d);
71 aux_opt= nlopt::opt(nlopt::LN_COBYLA,d);
74 aux_opt = nlopt::opt(nlopt::LN_BOBYQA,d);
77 aux_opt = nlopt::opt(nlopt::LD_LBFGS,d);
80 aux_opt.set_ftol_abs(m_aux_ftol);
81 aux_opt.set_xtol_abs(m_aux_xtol);
82 aux_opt.set_maxeval(m_aux_max_iter);
83 m_opt.set_local_optimizer(aux_opt);
88 std::ostringstream oss;
90 oss <<
"ftol: " <<
m_ftol <<
" ";
91 oss <<
"xtol: " <<
m_xtol <<
" ";
92 oss <<
"aux_max_iter: " << m_aux_max_iter <<
' ';
93 oss <<
"aux_ftol: " << m_aux_ftol <<
" ";
94 oss <<
"aux_xtol: " << m_aux_xtol;
103 switch(m_aux_algo_id)
119 return "Augmented Lagrangian - " + local +
" (NLOPT)";
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base algorithm.
Wrapper for NLopt's Augmented Lagrangian algorithm.
std::string get_name() const
Algorithm name.
nlopt::opt m_opt
NLOPT optimization method.
std::string human_readable_extra() const
Extra information in human readable format.
const double m_xtol
Tolerance on the decision_vector variation function (stopping criteria)
Base class for wrapping NLopt's algorithms.
const std::size_t m_max_iter
Maximum number of iterations.
base_ptr clone() const
Clone method.
void set_local(size_t) const
Set the local optimizer.
const double m_ftol
Tolerance on the fitness function variation (stopping criteria)
nlopt_aug_lag(int=1, int=100, const double &=1E-6, const double &=1E-6, int=100, const double &=1E-6, const double &=1E-6)
Constructor.