Powell scheme optimizer with repeated kickouts for likelihoods. More...

#include "optimizing/optimizer_kickout_powell.h"

Collaboration diagram for optimizer_kickout_powell:

Public Member Functions

 optimizer_kickout_powell (int seed)
 Class constructor, accepts the integer seed for a random number generator as an argument.
 
std::vector< double > run_optimizer (likelihood &L, int dof_estimate, std::string optimizer_results_filename="Opt.dat", size_t number_of_instances=0, size_t number_of_restarts=2, double tolerance=1e-10)
 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, int dof_estimate, std::vector< double > start_parameter_values, std::string optimizer_results_filename="Opt.dat", size_t number_of_instances=0, size_t number_of_restarts=2, double tolerance=1e-10)
 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, int dof_estimate, std::vector< std::vector< double > > start_parameter_values, std::string optimizer_results_filename="Opt.dat", size_t number_of_restarts=2, double tolerance=1e-10)
 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...
 
void set_kickout_parameters (double kickout_loglikelihood_reduction_factor=10.0, size_t kickout_itermax=20, size_t kickout_rounds=20)
 Function to set the meta-parameters associated with the kickout procedure. 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, int itermax=0)
 Function to ncapsulate the process of optimization. Returns the maximized likelihood and resets pvec to the optimal position. More...
 
double func (double p[])
 
double tempered_func (std::vector< double > p, double prior_edge_beta=1.0)
 
double f1dim (double x)
 
void powell (double p[], double **xi, double ftol, int &iter, double &fret, int itermax=0)
 
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 _prior_edge_beta
 
int _dof_estimate
 
double _ko_ll_red_fac
 
size_t _ko_itermax
 
size_t _ko_rounds
 
double * _pcom
 
double * _xicom
 

Detailed Description

Maximizes a given likelihood using the tempered_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 instances at random/specified locations. Multiple rounds of trial solutions of a fixed number of Powell iterations are generated and then compared to an estimate of the expected value. If too small, a new random point is chosen. This drives the optimizer to try increasingly better locations. To avoid pathological behavior at the prior limits, if present, the likelihood is "tempered" near the boundary by a function that drives the likelihood to zero to generate smooth maxima. (This does not appear to be particularly important.)

Todo:

Member Function Documentation

std::vector< double > generate_start_point ( likelihood L)
private
Parameters
Pvector of pointers to priors.

Here is the call graph for this function:

Here is the caller graph for this function:

double get_optimal_point ( std::vector< double > &  pvec,
double  tolerance,
int  itermax = 0 
)
private
Parameters
pvecvector of start parameter position, reset to the optimal point.
Pvector of pointers to priors.
tolerancenumerical tolerance at which to terminate maximization.

Here is the caller graph for this function:

std::vector< double > run_optimizer ( likelihood L,
int  dof_estimate,
std::string  optimizer_results_filename = "Opt.dat",
size_t  number_of_instances = 0,
size_t  number_of_restarts = 2,
double  tolerance = 1e-10 
)
Parameters
LAn object of class likelihood.
dof_estimateAn estimate of the number of expected degrees of freedom. Better estimates will produce better quality checks, but even bad estimates are very useful.
optimizer_results_filenameName of file to which to write summary data. Default is Opt.dat.
number_of_instancesNumber 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_restartsThe number of times to restart each optimizer realization from the best point. Default 2.
toleranceConvergence 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,
int  dof_estimate,
std::vector< double >  start_parameter_values,
std::string  optimizer_results_filename = "Opt.dat",
size_t  number_of_instances = 0,
size_t  number_of_restarts = 2,
double  tolerance = 1e-10 
)
Parameters
LAn object of class likelihood.
dof_estimateAn estimate of the number of expected degrees of freedom. Better estimates will produce better quality checks, but even bad estimates are very useful.
start_parameter_valuesA vector of a single start point that we want to initialize a Powell optimization around.
optimizer_results_filenameName of file to which to write summary data. Default is Opt.dat.
number_of_instancesNumber 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_restartsThe number of times to restart each optimizer realization from the best point. Default 2.
toleranceConvergence tolerance. Default 1e-15.

Here is the call graph for this function:

std::vector< double > run_optimizer ( likelihood L,
int  dof_estimate,
std::vector< std::vector< double > >  start_parameter_values,
std::string  optimizer_results_filename = "Opt.dat",
size_t  number_of_restarts = 2,
double  tolerance = 1e-10 
)
Parameters
LAn object of class likelihood.
dof_estimateAn estimate of the number of expected degrees of freedom. Better estimates will produce better quality checks, but even bad estimates are very useful.
start_parameter_valuesA vector of start points at which to initialize every Powell optimization around. Note that this sets the number of instances explicitly.
optimizer_results_filenameName of file to which to write summary data. Default is Opt.dat.
number_of_restartsThe number of times to restart each optimizer realization from the best point. Default 2.
toleranceConvergence tolerance. Default 1e-15.

Here is the call graph for this function:

void set_cpu_distribution ( int  num_likelihood)
Parameters
num_likelihoodnumber of threads allocated for each likelihood calculation.
void set_kickout_parameters ( double  kickout_loglikelihood_reduction_factor = 10.0,
size_t  kickout_itermax = 20,
size_t  kickout_rounds = 20 
)
Parameters
kickout_loglikelihood_reduction_factorFactor by which to multiply the negative of the number of degrees of freedom above which a maximized likelihood is acceptable. Default 10.
kickout_itermaxNumber of Powell iterations before kickout assessment. Default 20.
kickout_roundsNumber of kickout rounds to perform. Default 20.

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