Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
BFGS_Powell Class Reference

A class implementing the BFGS optimizer based on conjugate gradient direction method of M. More...

#include <BFGS_Powell.h>

Inheritance diagram for BFGS_Powell:
Inheritance graph
[legend]

Public Member Functions

 BFGS_Powell (void(*f_pointer)(Matrix_real, void *, double *, Matrix_real &), void *meta_data_in)
 Constructor of the class. More...
 
double Start_Optimization (Matrix_real &x, long maximal_iterations_in=5001)
 Call this method to start the optimization. More...
 
 ~BFGS_Powell ()
 Destructor of the class. More...
 

Protected Member Functions

void BFGS_iteration (Matrix_real &x, Matrix_real &g, Matrix_real &x0_search, Matrix_real &g0_search, double &norm_Z)
 Method implementing the BFGS update of the matrix Z. More...
 
void get_f_ang_gradient (Matrix_real &x, double &f, Matrix_real &g)
 Call this method to obtain the cost function and its gradient at a gives position given by x. More...
 
void get_Maximal_Line_Search_Step (Matrix_real &search_direction, double &maximal_step, double &search_direction__grad_overlap)
 Call this method to obtain the maximal step size during the line search. More...
 
void get_search_direction (Matrix_real &g, Matrix_real &search_direction, double &search_direction__grad_overlap)
 Method to get the search direction in the next line search. More...
 
void Initialize_Zmtx ()
 Initialize the matrix Z to identity. More...
 
void line_search (Matrix_real &x, Matrix_real &g, Matrix_real &search_direction, Matrix_real &x0_search, Matrix_real &g0_search, double &maximal_step, double &d__dot__g, double &f)
 Call to perform inexact line search terminated with Wolfe 1st and 2nd conditions. More...
 
void Optimize (Matrix_real &x, double &f)
 Call this method to start the optimization process. More...
 

Protected Attributes

void(* costfnc__and__gradient )(Matrix_real x, void *params, double *f, Matrix_real &g)
 function pointer to evaluate the cost function and its gradient vector More...
 
void(* export_fnc )(double, Matrix_real &, void *)
 function pointer to evaluate the cost function and its gradient vector More...
 
long function_call_count
 number of function calls during the optimization process More...
 
long maximal_iterations
 maximal count of iterations during the optimization More...
 
void * meta_data
 additional data needed to evaluate the cost function More...
 
double num_precision
 numerical precision used in the calculations More...
 
enum solver_status status
 status of the solver More...
 
int variable_num
 number of independent variables in the problem More...
 
Matrix_real Z_T__dot__g
 
Matrix_real Zmtx
 

Detailed Description

A class implementing the BFGS optimizer based on conjugate gradient direction method of M.

J. D. Powell: A tolerant algorithm for linearly constrained optimization calculations, Mathematical Programming volume 45, pages 547–566 (1989)

Definition at line 26 of file BFGS_Powell.h.

Constructor & Destructor Documentation

◆ BFGS_Powell()

BFGS_Powell::BFGS_Powell ( void(*)(Matrix_real, void *, double *, Matrix_real &)  f_pointer,
void *  meta_data_in 
)

Constructor of the class.

Parameters
f_pointerA function pointer (x, meta_data, f, grad) to evaluate the cost function and its gradients. The cost function and the gradient vector are returned via reference by the two last arguments.
meta_datavoid pointer to additional meta data needed to evaluate the cost function.
Returns
An instance of the class

Definition at line 32 of file BFGS_Powell.cpp.

◆ ~BFGS_Powell()

BFGS_Powell::~BFGS_Powell ( )

Destructor of the class.

Definition at line 444 of file BFGS_Powell.cpp.

Member Function Documentation

◆ BFGS_iteration()

void BFGS_Powell::BFGS_iteration ( Matrix_real x,
Matrix_real g,
Matrix_real x0,
Matrix_real g0,
double &  norm_Z 
)
protected

Method implementing the BFGS update of the matrix Z.

See M.J.D. POWELL: UPDATING CONJUGATE DIRECTIONS BY THE BFGS FORMULA, Mathematical Programming 38 (1987) 29-46 for details.

Parameters
xThe current coordinates.
gThe gradient at the current coordinates.
x0_searchThe starting point used at the previous line search
g0_searchThe gradient at x0_search
norm_ZThe column-wise norm of the matrix Z is updated (and returned) via this argument.

See M.J.D. POWELL: UPDATING CONJUGATE DIRECTIONS BY THE BFGS FORMULA, Mathematical Programming 38 (1987) 29-46 for details.

Parameters
xThe current coordinates.
gThe current coordinates gradient.
x0_searchThe starting point used at the previous line search
g0_searchThe gradient at x0_search
d__dot__gThe overlap of the search direction and the gradient calculated in get_search_direction

Definition at line 202 of file BFGS_Powell.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_f_ang_gradient()

void Grad_Descend::get_f_ang_gradient ( Matrix_real x,
double &  f,
Matrix_real g 
)
protectedinherited

Call this method to obtain the cost function and its gradient at a gives position given by x.

Parameters
xThe array of the current coordinates
fThe value of the cost function is returned via this argument.
gThe gradient of the cost function at x.

Definition at line 443 of file common/grad_descend.cpp.

Here is the caller graph for this function:

◆ get_Maximal_Line_Search_Step()

void Grad_Descend::get_Maximal_Line_Search_Step ( Matrix_real search_direction,
double &  maximal_step,
double &  search_direction__grad_overlap 
)
protectedinherited

Call this method to obtain the maximal step size during the line search.

providing at least 2*PI periodicity, unless the search direction component in a specific direction is to small.

Parameters
search_directionThe search direction.
maximal_stepThe maximal allowed step in the search direction returned via this argument.
search_direction__grad_overlapThe overlap of the gradient with the search direction to test downhill.

Providing at least 2*PI periodicity, unless the search direction component in a specific direction is to small.

Parameters
search_directionThe search direction.
maximal_stepThe maximal allowed step in the search direction returned via this argument.
search_direction__grad_overlapThe overlap of the gradient with the search direction to test downhill.

Definition at line 401 of file common/grad_descend.cpp.

Here is the caller graph for this function:

◆ get_search_direction()

void BFGS_Powell::get_search_direction ( Matrix_real g,
Matrix_real search_direction,
double &  search_direction__grad_overlap 
)
protectedvirtual

Method to get the search direction in the next line search.

Parameters
gThe gradient at the current coordinates.
search_directionThe search direction is returned via this argument (calculated with g and with Zmtx)
search_direction__grad_overlapThe overlap of the gradient with the search direction to test downhill.

Reimplemented from Grad_Descend.

Definition at line 396 of file BFGS_Powell.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize_Zmtx()

void BFGS_Powell::Initialize_Zmtx ( )
protected

Initialize the matrix Z to identity.

See the definition of matrix Z at Eq (1.8) in M. J. D. Powell: A tolerant algorithm for linearly constrained optimization calculations, Mathematical Programming volume 45, pages 547–566 (1989)

Definition at line 41 of file BFGS_Powell.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ line_search()

void Grad_Descend::line_search ( Matrix_real x,
Matrix_real g,
Matrix_real search_direction,
Matrix_real x0_search,
Matrix_real g0_search,
double &  maximal_step,
double &  d__dot__g0,
double &  f 
)
protectedinherited

Call to perform inexact line search terminated with Wolfe 1st and 2nd conditions.

Parameters
xThe guess for the starting point. The coordinated of the optimized cost function are returned via x.
gThe gradient at x. The updated gradient is returned via this argument.
search_directionThe search direction.
x0_searchStores the starting point. (automatically updated with the starting x during the execution)
g0_searchStores the starting gradient. (automatically updated with the starting x during the execution)
maximal_stepThe maximal allowed step in the search direction
d__dot__gThe overlap of the gradient with the search direction to test downhill.
fThe value of the minimized cost function is returned via this argument

Definition at line 127 of file common/grad_descend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Optimize()

void BFGS_Powell::Optimize ( Matrix_real x,
double &  f 
)
protectedvirtual

Call this method to start the optimization process.

Parameters
xThe guess for the starting point. The coordinated of the optimized cost function are returned via x.
fThe value of the minimized cost function

Reimplemented from Grad_Descend.

Definition at line 70 of file BFGS_Powell.cpp.

Here is the call graph for this function:

◆ Start_Optimization()

double Grad_Descend::Start_Optimization ( Matrix_real x,
long  maximal_iterations_in = 5001 
)
inherited

Call this method to start the optimization.

Parameters
xThe initial solution guess.
maximal_iterations_inThe maximal number of function+gradient evaluations. Reaching this threshold the solver returns with the current solution.

Definition at line 83 of file common/grad_descend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ costfnc__and__gradient

void(* Grad_Descend::costfnc__and__gradient) (Matrix_real x, void *params, double *f, Matrix_real &g)
protectedinherited

function pointer to evaluate the cost function and its gradient vector

Definition at line 50 of file grad_descend.h.

◆ export_fnc

void(* Grad_Descend::export_fnc) (double, Matrix_real &, void *)
protectedinherited

function pointer to evaluate the cost function and its gradient vector

Definition at line 53 of file grad_descend.h.

◆ function_call_count

long Grad_Descend::function_call_count
protectedinherited

number of function calls during the optimization process

Definition at line 44 of file grad_descend.h.

◆ maximal_iterations

long Grad_Descend::maximal_iterations
protectedinherited

maximal count of iterations during the optimization

Definition at line 41 of file grad_descend.h.

◆ meta_data

void* Grad_Descend::meta_data
protectedinherited

additional data needed to evaluate the cost function

Definition at line 56 of file grad_descend.h.

◆ num_precision

double Grad_Descend::num_precision
protectedinherited

numerical precision used in the calculations

Definition at line 47 of file grad_descend.h.

◆ status

enum solver_status Grad_Descend::status
protectedinherited

status of the solver

Definition at line 59 of file grad_descend.h.

◆ variable_num

int Grad_Descend::variable_num
protectedinherited

number of independent variables in the problem

Definition at line 38 of file grad_descend.h.

◆ Z_T__dot__g

Matrix_real BFGS_Powell::Z_T__dot__g
protected

Definition at line 37 of file BFGS_Powell.h.

◆ Zmtx

Matrix_real BFGS_Powell::Zmtx
protected

Definition at line 34 of file BFGS_Powell.h.


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