IT++ Logo
Public Member Functions | List of all members
itpp::Newton_Search Class Reference

Newton Search. More...

#include <itpp/optim/newton_search.h>

Public Member Functions

 Newton_Search ()
 Default constructor. More...
 
 ~Newton_Search ()
 Destructor. More...
 
void set_function (double(*function)(const vec &))
 Set function pointer. More...
 
void set_gradient (vec(*gradient)(const vec &))
 Set gradient function pointer. More...
 
void set_functions (double(*function)(const vec &), vec(*gradient)(const vec &))
 Set both function and gradient function pointers. More...
 
void set_start_point (const vec &x, const mat &D)
 Set start point x for search and approx inverse Hessian at x. More...
 
void set_start_point (const vec &x)
 Set start point x for search. More...
 
vec get_solution ()
 Get solution, function value and gradient at solution point. More...
 
bool search ()
 Do the line search. More...
 
bool search (vec &xn)
 Do the line search and return solution. More...
 
bool search (const vec &x0, vec &xn)
 Set starting point, do the Newton search, and return the solution. More...
 
void set_stop_values (double epsilon_1, double epsilon_2)
 Set stop criterion values.
 
double get_epsilon_1 ()
 Return stop value rho. More...
 
double get_epsilon_2 ()
 Return stop value beta. More...
 
void set_max_evaluations (int value)
 Set max number of function evaluations.
 
int get_max_evaluations ()
 Return max number of function evaluations. More...
 
void set_initial_stepsize (double value)
 Set max stepsize.
 
double get_initial_stepsize ()
 Return max number of iterations. More...
 
void set_method (const Newton_Search_Method &method)
 Set Line search method.
 
double get_function_value ()
 get function value at solution point More...
 
double get_stop_1 ()
 get value of stop criterion 1 at solution point More...
 
double get_stop_2 ()
 get value of stop criterion 2 at solution point More...
 
int get_no_iterations ()
 get number of iterations used to reach solution More...
 
int get_no_function_evaluations ()
 get number of function evaluations used to reach solution More...
 
void enable_trace ()
 enable trace mode More...
 
void disable_trace ()
 disable trace More...
 
void get_trace (Array< vec > &xvalues, vec &Fvalues, vec &ngvalues, vec &dvalues)
 

Detailed Description

Newton Search.

Newton or Quasi-Newton optimization method that try to minimize the objective function $f(\mathbf{x})$ given an initial guess $\mathbf{x}$.

The search is stopped when either criterion 1:

\[
\left\| \mathbf{f}'(\mathbf{x})\right\|_{\infty} \leq \varepsilon_1
\]

or criterion 2:

\[
\left\| d\mathbf{x}\right\|_{2} \leq \varepsilon_2 (\varepsilon_2 + \| \mathbf{x} \|_{2} )
\]

is fulfilled. Another possibility is that the search is stopped when the number of function evaluations exceeds a threshold (100 per default).

The default update rule for the inverse of the Hessian matrix is the BFGS algorithm with $\varepsilon_1 = 10^{-4}$ an $\varepsilon_2 = 10^{-8}$.

Definition at line 72 of file newton_search.h.

Constructor & Destructor Documentation

◆ Newton_Search()

itpp::Newton_Search::Newton_Search ( )

Default constructor.

Definition at line 38 of file newton_search.cpp.

◆ ~Newton_Search()

itpp::Newton_Search::~Newton_Search ( )
inline

Destructor.

Definition at line 78 of file newton_search.h.

Member Function Documentation

◆ set_function()

void itpp::Newton_Search::set_function ( double(*)(const vec &)  function)

Set function pointer.

Definition at line 56 of file newton_search.cpp.

◆ set_gradient()

void itpp::Newton_Search::set_gradient ( vec(*)(const vec &)  gradient)

Set gradient function pointer.

Definition at line 62 of file newton_search.cpp.

◆ set_functions()

void itpp::Newton_Search::set_functions ( double(*)(const vec &)  function,
vec(*)(const vec &)  gradient 
)
inline

Set both function and gradient function pointers.

Definition at line 85 of file newton_search.h.

Referenced by itpp::fminunc().

◆ set_start_point() [1/2]

void itpp::Newton_Search::set_start_point ( const vec &  x,
const mat &  D 
)

Set start point x for search and approx inverse Hessian at x.

Definition at line 68 of file newton_search.cpp.

Referenced by search().

◆ set_start_point() [2/2]

void itpp::Newton_Search::set_start_point ( const vec &  x)

Set start point x for search.

Definition at line 79 of file newton_search.cpp.

References itpp::eye().

◆ get_solution()

vec itpp::Newton_Search::get_solution ( )

Get solution, function value and gradient at solution point.

Definition at line 254 of file newton_search.cpp.

References it_assert.

Referenced by search().

◆ search() [1/3]

bool itpp::Newton_Search::search ( )

◆ search() [2/3]

bool itpp::Newton_Search::search ( vec &  xn)

Do the line search and return solution.

Definition at line 239 of file newton_search.cpp.

References get_solution(), and search().

◆ search() [3/3]

bool itpp::Newton_Search::search ( const vec &  x0,
vec &  xn 
)

Set starting point, do the Newton search, and return the solution.

Definition at line 246 of file newton_search.cpp.

References get_solution(), search(), and set_start_point().

◆ get_epsilon_1()

double itpp::Newton_Search::get_epsilon_1 ( )
inline

Return stop value rho.

Definition at line 106 of file newton_search.h.

◆ get_epsilon_2()

double itpp::Newton_Search::get_epsilon_2 ( )
inline

Return stop value beta.

Definition at line 108 of file newton_search.h.

◆ get_max_evaluations()

int itpp::Newton_Search::get_max_evaluations ( )
inline

Return max number of function evaluations.

Definition at line 113 of file newton_search.h.

◆ get_initial_stepsize()

double itpp::Newton_Search::get_initial_stepsize ( )
inline

Return max number of iterations.

Definition at line 118 of file newton_search.h.

◆ get_function_value()

double itpp::Newton_Search::get_function_value ( )

get function value at solution point

Definition at line 260 of file newton_search.cpp.

References it_warning.

◆ get_stop_1()

double itpp::Newton_Search::get_stop_1 ( )

get value of stop criterion 1 at solution point

Definition at line 270 of file newton_search.cpp.

References it_warning.

◆ get_stop_2()

double itpp::Newton_Search::get_stop_2 ( )

get value of stop criterion 2 at solution point

Definition at line 280 of file newton_search.cpp.

References it_warning.

◆ get_no_iterations()

int itpp::Newton_Search::get_no_iterations ( )

get number of iterations used to reach solution

Definition at line 290 of file newton_search.cpp.

References it_warning.

◆ get_no_function_evaluations()

int itpp::Newton_Search::get_no_function_evaluations ( )

get number of function evaluations used to reach solution

Definition at line 300 of file newton_search.cpp.

References it_warning.

◆ enable_trace()

void itpp::Newton_Search::enable_trace ( )
inline

enable trace mode

Definition at line 135 of file newton_search.h.

References itpp::trace().

◆ disable_trace()

void itpp::Newton_Search::disable_trace ( )
inline

disable trace

Definition at line 137 of file newton_search.h.

References itpp::trace().

◆ get_trace()

void itpp::Newton_Search::get_trace ( Array< vec > &  xvalues,
vec &  Fvalues,
vec &  ngvalues,
vec &  dvalues 
)

get trace outputs xvalues are the solutions of every iteration Fvalues are the function values ngvalues are the norm(gradient,inf) values dvalues are the delta values

Definition at line 311 of file newton_search.cpp.

References it_warning.


The documentation for this class was generated from the following files:

Generated on Tue Aug 17 2021 10:59:15 for IT++ by Doxygen 1.9.4