Inheritance diagram for Purple::GradientDescent:
Definition at line 29 of file GradientDescent.h.
Available optimization operators for obtaining the optimal step size.
Definition at line 38 of file GradientDescent.h.
Purple::GradientDescent::GradientDescent | ( | ObjectiveFunction * | newObjectiveFunction | ) |
General constructor. It creates a gradient descent object associated to an objective function object. It also initializes the class members to their default values:
Initial argument: Random point whithin the objective function domain.
Optimization operators:
Optimization parameters:
Stopping criteria:
User stuff:
newObjectiveFunction,: | Pointer to an objective function object. |
Definition at line 62 of file GradientDescent.cpp.
Purple::GradientDescent::GradientDescent | ( | void | ) |
Default constructor. It creates a gradient descent optimization algorithm object not associated to any objective function object. It also initializes the class members to their default values:
Optimization operators:
Optimization parameters:
Stopping criteria:
User stuff:
Definition at line 138 of file GradientDescent.cpp.
Purple::GradientDescent::~GradientDescent | ( | void | ) | [virtual] |
double Purple::GradientDescent::getGoldenSectionOptimalStepSize | ( | double | initialStepSize, | |
double | evaluation, | |||
Vector< double > | argument, | |||
Vector< double > | searchDirection | |||
) | [private] |
This method returns the optimal step size by searching in a given direction to locate the minimum of the objective function in that direction. It uses the golden section method.
initialStepSize,: | Initial step size in line search. | |
evaluation,: | Objective function evaluation value. | |
argument,: | Objective function argument Vector. | |
searchDirection,: | Search direction Vector. |
Definition at line 508 of file GradientDescent.cpp.
double Purple::GradientDescent::getBrentMethodOptimalStepSize | ( | double | initialStepSize, | |
double | evaluation, | |||
Vector< double > | argument, | |||
Vector< double > | searchDirection | |||
) | [private] |
This method returns the optimal step size by searching in a given direction to locate the minimum of the objective function in that direction. It uses the Brent's method.
initialStepSize,: | Initial step size in line search. | |
evaluation,: | Objective function evaluation value. | |
argument,: | Objective function argument Vector. | |
searchDirection,: | Search direction Vector. |
Definition at line 728 of file GradientDescent.cpp.
double Purple::GradientDescent::getMinimum | ( | Vector< double > | v | ) | [private] |
This method returns the minimum element in a Vector of double precision numbers.
v,: | Vector of double precision numbers. |
Definition at line 1780 of file GradientDescent.cpp.
double Purple::GradientDescent::getMaximum | ( | Vector< double > | v | ) | [private] |
This method returns the maximum element in a Vector of double precision numbers.
v,: | Vector of double precision numbers. |
Definition at line 1806 of file GradientDescent.cpp.
Vector< double > Purple::GradientDescent::getInitialArgument | ( | void | ) |
This method returns the initial objective function argument to be used by the gradient descent method for optimization.
Definition at line 194 of file GradientDescent.cpp.
GradientDescent::OptimalStepSizeMethod Purple::GradientDescent::getOptimalStepSizeMethod | ( | void | ) |
This method returns the search direction method used for optimization.
getPolakRibiereSearchDirection(Vector<double>, Vector<double>, Vector<double>).
Definition at line 183 of file GradientDescent.cpp.
double Purple::GradientDescent::getFirstStepSize | ( | void | ) |
This method returns the initial step size for line search in the first iteration of the gradient descent.
getBrentMethodOptimalStepSize(double, double, Vector<double>, Vector<double>).
Definition at line 232 of file GradientDescent.cpp.
double Purple::GradientDescent::getOptimalStepSizeTolerance | ( | void | ) |
This method returns the tolerance value in line search.
getBrentMethodOptimalStepSize(double, double, Vector<double>, Vector<double>).
Definition at line 245 of file GradientDescent.cpp.
double Purple::GradientDescent::getGradientNormGoal | ( | void | ) |
This method returns the goal value for the norm of the objective function gradient. This is used as a stopping criterium when optimizing a function.
Definition at line 206 of file GradientDescent.cpp.
int Purple::GradientDescent::getMaximumNumberOfIterations | ( | void | ) |
This method returns the maximum number of iterations to be performed by the gradient descent method during the optimization process. This is used as a stopping criterium when optimizing an objective function.
Definition at line 218 of file GradientDescent.cpp.
int Purple::GradientDescent::getShowPeriod | ( | void | ) |
This method returns the number of iterations between the optimization showing progress.
Definition at line 270 of file GradientDescent.cpp.
double Purple::GradientDescent::getWarningStepSize | ( | void | ) |
This method returns the step size value at wich a warning message is written to the screen during line search.
getBrentMethodOptimalStepSize(double, double, Vector<double>, Vector<double>).
Definition at line 259 of file GradientDescent.cpp.
void Purple::GradientDescent::setInitialArgument | ( | Vector< double > | newInitialArgument | ) |
This method sets a new initial objective function argument to be used by the gradient descent method for optimization.
newInitialArgument,: | Initial argument Vector. |
Definition at line 300 of file GradientDescent.cpp.
void Purple::GradientDescent::setOptimalStepSizeMethod | ( | GradientDescent::OptimalStepSizeMethod | newOptimalStepSizeMethod | ) |
This method sets a new optimal step size method to be used for optimization with the gradient descent method.
newOptimalStepSizeMethod,: | Optimal step size method. |
getBrentMethodOptimalStepSize(double, double, Vector<double>, Vector<double>).
Definition at line 287 of file GradientDescent.cpp.
void Purple::GradientDescent::setFirstStepSize | ( | double | newFirstStepSize | ) |
This method sets a new initial step size for line search in the first iteration of the gradient descent.
newFirstStepSize,: | First step size. |
getBrentMethodOptimalStepSize(double, double, Vector<double>, Vector<double>).
Definition at line 414 of file GradientDescent.cpp.
void Purple::GradientDescent::setOptimalStepSizeTolerance | ( | double | newOptimalStepSizeTolerance | ) |
This method sets a new tolerance value to be used in line minimization.
newOptimalStepSizeTolerance,: | Line search tolerance. |
getBrentMethodOptimalStepSize(double, double, Vector<double>, Vector<double>).
Definition at line 443 of file GradientDescent.cpp.
void Purple::GradientDescent::setGradientNormGoal | ( | double | newGradientNormGoal | ) |
This method sets a new the goal value for the norm of the objective function gradient. This is used as a stopping criterium when optimizing an objective function.
newGradientNormGoal,: | Goal value for the norm of the objective function gradient. |
Definition at line 331 of file GradientDescent.cpp.
void Purple::GradientDescent::setMaximumNumberOfIterations | ( | int | newMaximumNumberOfIterations | ) |
This method sets a new maximum number of iterations in the optimization process.
newMaximumNumberOfIterations,: | Maximum number of iterations. |
Definition at line 358 of file GradientDescent.cpp.
void Purple::GradientDescent::setShowPeriod | ( | int | newShowPeriod | ) |
This method sets a new number of iterations between the optimization showing progress.
newShowPeriod,: | Show period. |
Definition at line 385 of file GradientDescent.cpp.
void Purple::GradientDescent::setWarningStepSize | ( | double | newWarningStepSize | ) |
This method sets a new step size value at wich a warning message is written to the screen during line minimization.
newWarningStepSize,: | Warning step size value. |
getBrentMethodOptimalStepSize(double, double, Vector<double>, Vector<double>).
Definition at line 473 of file GradientDescent.cpp.
Vector< double > Purple::GradientDescent::getMinimalArgument | ( | void | ) | [virtual] |
This method optimizes an objective function according to the gradient descent algorithm. It returns the minimal argument of the objective function. Optimization occurs according to the optimization operators and the optimization parameters.
Implements Purple::OptimizationAlgorithm.
Definition at line 1031 of file GradientDescent.cpp.
void Purple::GradientDescent::print | ( | void | ) |
This method prints to the screen the optimization operators and the optimization parameters concerning the gradient descent object:
Initial argument.
Optimization operators:
Optimization parameters:
Stopping criteria:
User stuff:
Definition at line 1349 of file GradientDescent.cpp.
void Purple::GradientDescent::load | ( | char * | filename | ) |
This method loads a gradient descent object from a data file. Please mind about the file format, wich is specified in the User's Guide.
Initial argument.
Optimization operators:
Optimization parameters:
Stopping criteria:
User stuff:
filename,: | Filename. |
Definition at line 1592 of file GradientDescent.cpp.
void Purple::GradientDescent::save | ( | char * | filename | ) |
This method saves the gradient descent object to a data file.
Initial argument.
Optimization operators:
Optimization parameters:
Stopping criteria:
User stuff:
filename,: | Filename. |
Definition at line 1462 of file GradientDescent.cpp.
void Purple::GradientDescent::saveOptimizationHistory | ( | char * | filename | ) |
This method saves the optimization history to a data file:
filename,: | Filename. |
Definition at line 1722 of file GradientDescent.cpp.
Vector<double> Purple::GradientDescent::initialArgument [private] |
double Purple::GradientDescent::gradientNormGoal [private] |
Objective function gradient norm goal. It is used as a stopping criterion.
Definition at line 50 of file GradientDescent.h.
int Purple::GradientDescent::maximumNumberOfIterations [private] |
Maximum number of iterations. It is used as a stopping criterion.
Definition at line 55 of file GradientDescent.h.
int Purple::GradientDescent::showPeriod [private] |
Number of iterations between the optimization showing progress.
Definition at line 59 of file GradientDescent.h.
double Purple::GradientDescent::firstStepSize [private] |
Inititial step size in line search for first iteration of gradient descent.
Definition at line 63 of file GradientDescent.h.
double Purple::GradientDescent::optimalStepSizeTolerance [private] |
double Purple::GradientDescent::warningStepSize [private] |
Step size value at wich a warning message is written to the screen.
Definition at line 71 of file GradientDescent.h.
Vector<double> Purple::GradientDescent::evaluationHistory [private] |
Evaluation of objective function optimization history.
Definition at line 75 of file GradientDescent.h.
Vector<double> Purple::GradientDescent::gradientNormHistory [private] |
Gradient norm of objective function optimization history.
Definition at line 79 of file GradientDescent.h.
Definition at line 90 of file GradientDescent.h.