53 void NLOPTMinimizer::init()
75 if(bound_constraints_fun)
80 nlopt_set_lower_bounds1(opt, bound[0]);
85 "The length of target variable (%d) and the length of lower bound (%d) do not match\n",
87 nlopt_set_lower_bounds(opt, bound.
vector);
93 nlopt_set_upper_bounds1(opt, bound[0]);
98 "The length of target variable (%d) and the length of upper bound (%d) do not match\n",
100 nlopt_set_upper_bounds(opt, bound.
vector);
110 nlopt_set_min_objective(opt, NLOPTMinimizer::nlopt_function,
this);
121 SG_SWARNING(
"Error(s) happened and NLopt failed during minimization (error code:%d)\n",
144 double NLOPTMinimizer::nlopt_function(
unsigned dim,
const double* variable,
double* gradient,
148 REQUIRE(obj_prt,
"The instance object passed to NLopt optimizer should not be NULL\n");
154 "The length of gradient (%d) and the length of variable (%d) do not match\n",
virtual SGVector< float64_t > get_gradient()=0
SGVector< float64_t > m_target_variable
virtual ~NLOPTMinimizer()
virtual SGVector< float64_t > get_upper_bound()=0
FirstOrderCostFunction * m_fun
virtual void init_minimization()
nlopt_algorithm m_nlopt_algorithm
The first order cost function base class with bound constrains.
float64_t m_variable_tolerance
virtual float64_t minimize()
float64_t m_function_tolerance
The first order cost function base class.
virtual float64_t get_cost()=0
all of classes and functions are contained in the shogun namespace
float64_t m_max_iterations
virtual SGVector< float64_t > get_lower_bound()=0
The class wraps the external NLOPT library.
virtual SGVector< float64_t > obtain_variable_reference()=0
virtual void set_nlopt_parameters(nlopt_algorithm algorithm=NLOPT_LD_LBFGS, float64_t max_iterations=1000, float64_t variable_tolerance=1e-6, float64_t function_tolerance=1e-6)
The first order minimizer base class.