27 #include "base_nlopt.h"
28 #include "nlopt_aug_lag_eq.h"
30 namespace pagmo {
namespace algorithm {
49 nlopt_aug_lag_eq::nlopt_aug_lag_eq(
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) {
50 if ( (aux_ftol <= 0) || (aux_xtol <= 0) ) {
51 pagmo_throw(value_error,
"tolerances for the local optimizer must be positive");
53 if ((aux_algo_id >2)||(aux_algo_id<1)) {
54 pagmo_throw(value_error,
"local algorithm id must be one of 1.2");
65 nlopt::opt aux_opt(nlopt::LN_COBYLA,1);
69 aux_opt = nlopt::opt(nlopt::LN_COBYLA,d);
72 aux_opt= nlopt::opt(nlopt::LD_MMA,d);
75 aux_opt.set_ftol_abs(m_aux_ftol);
76 aux_opt.set_xtol_abs(m_aux_xtol);
77 aux_opt.set_maxeval(m_aux_max_iter);
78 m_opt.set_local_optimizer(aux_opt);
83 std::ostringstream oss;
85 oss <<
"ftol: " <<
m_ftol <<
" ";
86 oss <<
"xtol: " <<
m_xtol <<
" ";
87 oss <<
"aux_max_iter: " << m_aux_max_iter <<
' ';
88 oss <<
"aux_ftol: " << m_aux_ftol <<
" ";
89 oss <<
"aux_xtol: " << m_aux_xtol;
108 return "Augmented Lagrangian (EQ) - " + aux +
" (NLOPT)";
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base algorithm.
Wrapper for NLopt's Augmented Lagrangian algorithm (using penalties only for the equalities) ...
nlopt::opt m_opt
NLOPT optimization method.
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.
std::string human_readable_extra() const
Extra information in human readable format.
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_eq(int=1, int=100, const double &=1E-6, const double &=1E-6, int=100, const double &=1E-6, const double &=1E-6)
Constructor.
base_ptr clone() const
Clone method.
std::string get_name() const
Algorithm name.