optimizer_powell Class Reference
Powell scheme optimizer for likelihoods. More...
#include "optimizing/optimizer_powell.h"
Collaboration diagram for optimizer_powell:
Public Member Functions | |
optimizer_powell (int seed) | |
Class constructor, accepts the integer seed for a random number generator as an argument. | |
std::vector< double > | run_optimizer (likelihood &L, std::string optimizer_results_filename="Opt.dat", size_t number_of_instances=0, size_t number_of_restarts=1, double tolerance=1e-15) |
Function to run the optimizer, takes a likelihood object, vector of priors, name of an optimizer output file, and tuning parameters for the optimizer. More... | |
std::vector< double > | run_optimizer (likelihood &L, std::vector< double > start_parameter_values, std::string optimizer_results_filename="Opt.dat", size_t number_of_instances=0, size_t number_of_restarts=1, double tolerance=1e-15) |
Function to run the optimizer, takes a likelihood object, vector of priors, name of an optimizer output file, and tuning parameters for the optimizer. More... | |
std::vector< double > | run_optimizer (likelihood &L, std::vector< std::vector< double > > start_parameter_values, std::string optimizer_results_filename="Opt.dat", size_t number_of_restarts=1, double tolerance=1e-15) |
Function to run the optimizer, takes a likelihood object, vector of priors, name of an optimizer output file, and tuning parameters for the optimizer. More... | |
void | set_cpu_distribution (int num_likelihood) |
Function to set the distribution of processors in different layers of parallelization. More... | |
Private Member Functions | |
std::vector< double > | generate_start_point (likelihood &L) |
Function to generate a random starting point given the bounds on the prior. Assumes an arctan distribution if both bounds on the prior are infinity, an exponential distribution if the bound on one side is infinity, and a uniform distribution if both bounds are finite. More... | |
double | get_optimal_point (std::vector< double > &pvec, double tolerance) |
Function to ncapsulate the process of optimization. Returns the maximized likelihood and resets pvec to the optimal position. More... | |
double | func (double p[]) |
double | f1dim (double x) |
void | powell (double p[], double **xi, double ftol, int &iter, double &fret) |
void | linmin (double p[], double xi[], double &fret) |
double | brent (double ax, double bx, double cx, double tol, double &xmin) |
void | mnbrak (double *ax, double *bx, double *cx, double *fa, double *fb, double *fc) |
Private Attributes | |
likelihood * | _Lptr |
size_t | _ndim |
int | _num_likelihood |
Ran2RNG | _rng |
double * | _pcom |
double * | _xicom |
Detailed Description
Maximizes a given likelihood using the powell method as described in Numerical Recipes in C (1992; Press, Teukoslky, Vetterling and Flannery). An attempt to generate a global maximum is made by starting many powelles at random/specified locations. The maximum allowed iteratitons is set to 200.
Member Function Documentation
|
private |
- Parameters
-
P vector of pointers to priors.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
- Parameters
-
pvec vector of start parameter position, reset to the optimal point. P vector of pointers to priors. tolerance numerical tolerance at which to terminate maximization.
Here is the caller graph for this function:
std::vector< double > run_optimizer | ( | likelihood & | L, |
std::string | optimizer_results_filename = "Opt.dat" , |
||
size_t | number_of_instances = 0 , |
||
size_t | number_of_restarts = 1 , |
||
double | tolerance = 1e-15 |
||
) |
- Parameters
-
L An object of class likelihood. P A vector of pointers to priors. optimizer_results_filename Name of file to which to write summary data. Default is Opt.dat. number_of_instances Number of independent realizations of the optimizer to run. When set to 0 will run the maximum allowed by the number of processes being used. Default is 0. number_of_restarts The number of times to restart each optimizer realization from the best point. Default 2. tolerance Convergence tolerance. Default 1e-15.
Here is the call graph for this function:
Here is the caller graph for this function:
std::vector< double > run_optimizer | ( | likelihood & | L, |
std::vector< double > | start_parameter_values, | ||
std::string | optimizer_results_filename = "Opt.dat" , |
||
size_t | number_of_instances = 0 , |
||
size_t | number_of_restarts = 1 , |
||
double | tolerance = 1e-15 |
||
) |
- Parameters
-
L An object of class likelihood. P A vector of pointers to priors. start_parameter_values A vector of a single start point that we want to initialize a powell around. optimizer_results_filename Name of file to which to write summary data. Default is Opt.dat. number_of_instances Number of independent realizations of the optimizer to run. When set to 0 will run the maximum allowed by the number of processes being used. Default is 0. number_of_restarts The number of times to restart each optimizer realization from the best point. Default 2. tolerance Convergence tolerance. Default 1e-15.
Here is the call graph for this function:
std::vector< double > run_optimizer | ( | likelihood & | L, |
std::vector< std::vector< double > > | start_parameter_values, | ||
std::string | optimizer_results_filename = "Opt.dat" , |
||
size_t | number_of_restarts = 1 , |
||
double | tolerance = 1e-15 |
||
) |
- Parameters
-
L An object of class likelihood. P A vector of pointers to priors. start_parameter_values A vector of start points at which to initialize every powell around. Note that this sets the number of instances explicitly. optimizer_results_filename Name of file to which to write summary data. Default is Opt.dat. number_of_restarts The number of times to restart each optimizer realization from the best point. Default 2. tolerance Convergence tolerance. Default 1e-15.
Here is the call graph for this function:
void set_cpu_distribution | ( | int | num_likelihood | ) |
- Parameters
-
num_likelihood number of threads allocated for each likelihood calculation.
The documentation for this class was generated from the following files:
- optimizing/optimizer_powell.h
- optimizing/optimizer_powell.cpp