libcmaes 0.10.2
A C++11 library for stochastic optimization with CMA-ES
|
Holder of the set of evolving solutions from running an instance of CMA-ES. More...
#include <libcmaes/cmasolutions.h>
Public Member Functions | |
CMASolutions () | |
dummy constructor. | |
template<class TGenoPheno = GenoPheno<NoBoundStrategy>> | |
CMASolutions (Parameters< TGenoPheno > &p) | |
initializes solutions from stochastic optimization parameters. | |
void | sort_candidates () |
sorts the current internal set of solution candidates. | |
void | update_best_candidates () |
updates the history of best candidates, as well as other meaningful values, typically used in termination criteria. | |
void | update_eigenv (const dVec &eigenvalues, const dMat &eigenvectors) |
updates reference eigenvalue and eigenvectors, for use in termination criteria. | |
Candidate | best_candidate () const |
returns current best solution candidate. NOTE: candidates MUST be sorted | |
Candidate | get_best_seen_candidate () const |
returns the best seen candidate. | |
Candidate | get_worst_seen_candidate () const |
returns the worst seen candidate. | |
Candidate & | get_candidate (const int &r) |
get a reference to the r-th candidate in current set | |
Candidate | get_candidate (const int &r) const |
std::vector< Candidate > & | candidates () |
get a reference to the full candidate set | |
int | size () const |
number of candidate solutions. | |
void | reset () |
resets the solution object in order to restart from the current solution with fresh covariance matrix. Note: experimental. | |
void | reset_as_fixed (const int &k) |
re-arrange solution object such that parameter 'k' is fixed (i.e. removed). | |
bool | get_pli (const int &k, pli &p) const |
get profile likelihood if previously computed. | |
int | dim () const |
return problem dimension. | |
double | edm () const |
returns expected distance to minimum. | |
dMat | cov () const |
returns error covariance matrix | |
const dMat & | cov_ref () const |
returns reference to error covariance matrix | |
const double * | cov_data () const |
returns pointer to covariance matrix array | |
dMat | full_cov () const |
returns full covariance matrix. Similar to cov() but in case of linear-sized algorithms like sep and vd, returns the full covariance matrix anyways. | |
dMat | sepcov () const |
returns separable covariance diagonal matrix, only applicable to sep-CMA-ES algorithms. | |
const dMat & | sepcov_ref () const |
returns reference to separable covariance diagonal vector, only applicable to sep-CMA-ES algorithms. | |
const double * | sepcov_data () const |
returns pointer to covariance diagnoal vector | |
dMat | csqinv () const |
returns inverse root square of covariance matrix | |
dMat | sepcsqinv () const |
returns inverse root square of separable covariance diagonal matrix, only applicable to sep-CMA-ES algorithms. | |
template<class TGenoPheno = GenoPheno<NoBoundStrategy>> | |
dVec | stds (const CMAParameters< TGenoPheno > &cmaparams) const |
template<class TGenoPheno = GenoPheno<NoBoundStrategy>> | |
dVec | errors (const CMAParameters< TGenoPheno > &cmaparams) const |
dMat | corr () const |
returns correlation matrix | |
double | corr (const int &i, const int &j) const |
returns correlation between parameter i and j (useful in large-scale settings) | |
double | sigma () const |
returns current value of step-size sigma | |
void | set_sigma (const double &sigma) |
sets new step-size value, use with care | |
dVec | xmean () const |
returns current distribution's mean in parameter space | |
void | set_xmean (const dVec &xmean) |
sets the current distributions' mean in parameter space | |
int | run_status () const |
returns current optimization status. | |
std::string | status_msg () const |
returns current optimization status' message. | |
int | elapsed_time () const |
returns currently elapsed time spent on optimization | |
int | elapsed_last_iter () const |
returns time spent on last iteration | |
int | niter () const |
returns current number of iterations | |
int | nevals () const |
returns current budget (number of objective function calls) | |
double | min_eigenv () const |
returns current minimal eigen value | |
double | max_eigenv () const |
returns current maximal eigen value | |
bool | updated_eigen () const |
returns whether the last update is lazy | |
int | fevals () const |
returns current number of objective function evaluations | |
dVec | eigenvalues () const |
returns last computed eigenvalues | |
dMat | eigenvectors () const |
returns last computed eigenvectors | |
template<class TGenoPheno = GenoPheno<NoBoundStrategy>> | |
std::ostream & | print (std::ostream &out, const int &verb_level=0, const TGenoPheno &gp=TGenoPheno()) const |
print the solution object out. | |
Private Attributes | |
dMat | _cov |
dMat | _csqinv |
dMat | _sepcov |
dMat | _sepcsqinv |
dVec | _xmean |
dVec | _psigma |
dVec | _pc |
short | _hsig = 1 |
double | _sigma |
std::vector< Candidate > | _candidates |
std::vector< Candidate > | _best_candidates_hist |
int | _max_hist = -1 |
double | _max_eigenv = 0.0 |
double | _min_eigenv = 0.0 |
dVec | _leigenvalues |
dMat | _leigenvectors |
int | _niter = 0 |
int | _nevals = 0 |
int | _kcand = 1 |
std::vector< Candidate > | _k_best_candidates_hist |
std::vector< double > | _bfvalues |
std::vector< double > | _median_fvalues |
int | _eigeniter = 0 |
bool | _updated_eigen = true |
int | _run_status = 0 |
int | _elapsed_time = 0 |
int | _elapsed_last_iter = 0 |
std::map< int, pli > | _pls |
double | _edm = 0.0 |
Candidate | _best_seen_candidate |
int | _best_seen_iter |
Candidate | _worst_seen_candidate |
Candidate | _initial_candidate |
dVec | _v |
std::vector< RankedCandidate > | _candidates_uh |
int | _lambda_reev |
double | _suh |
double | _tpa_s = 0.0 |
int | _tpa_p1 = 0 |
int | _tpa_p2 = 1 |
dVec | _tpa_x1 |
dVec | _tpa_x2 |
dVec | _xmean_prev |
Friends | |
template<class U , class V > | |
class | CMAStrategy |
template<class U , class V , class W > | |
class | ESOptimizer |
template<class U , class V , class W > | |
class | ESOStrategy |
template<class U > | |
class | CMAStopCriteria |
template<class U , class V > | |
class | IPOPCMAStrategy |
template<class U , class V > | |
class | BIPOPCMAStrategy |
class | CovarianceUpdate |
class | ACovarianceUpdate |
template<class U > | |
class | errstats |
class | VDCMAUpdate |
Holder of the set of evolving solutions from running an instance of CMA-ES.
libcmaes::CMASolutions::CMASolutions | ( | Parameters< TGenoPheno > & | p | ) |
initializes solutions from stochastic optimization parameters.
p | parameters |
|
inline |
returns current best solution candidate. NOTE: candidates MUST be sorted
dMat libcmaes::CMASolutions::corr | ( | ) | const |
returns correlation matrix
returns correlation between parameter i and j (useful in large-scale settings)
|
inline |
returns error covariance matrix
returns pointer to covariance matrix array
|
inline |
returns reference to error covariance matrix
|
inline |
returns inverse root square of covariance matrix
|
inline |
return problem dimension.
|
inline |
returns expected distance to minimum.
|
inline |
returns last computed eigenvalues
|
inline |
returns last computed eigenvectors
|
inline |
returns time spent on last iteration
|
inline |
returns currently elapsed time spent on optimization
|
inline |
cmaparams | parameter object that hold the genotype/phenotype transform |
|
inline |
returns current number of objective function evaluations
dMat libcmaes::CMASolutions::full_cov | ( | ) | const |
returns full covariance matrix. Similar to cov() but in case of linear-sized algorithms like sep and vd, returns the full covariance matrix anyways.
|
inline |
returns the best seen candidate.
get a reference to the r-th candidate in current set
r | candidate position |
|
inline |
returns the worst seen candidate.
|
inline |
returns current maximal eigen value
|
inline |
returns current minimal eigen value
|
inline |
returns current budget (number of objective function calls)
|
inline |
returns current number of iterations
template CMAES_EXPORT std::ostream & libcmaes::CMASolutions::print | ( | std::ostream & | out, |
const int & | verb_level = 0 , |
||
const TGenoPheno & | gp = TGenoPheno() |
||
) | const |
print the solution object out.
out | output stream |
verb_level | verbosity level: 0 for short, 1 for debug. |
re-arrange solution object such that parameter 'k' is fixed (i.e. removed).
k | index of the parameter to remove. |
|
inline |
returns current optimization status.
|
inline |
returns separable covariance diagonal matrix, only applicable to sep-CMA-ES algorithms.
returns pointer to covariance diagnoal vector
|
inline |
returns reference to separable covariance diagonal vector, only applicable to sep-CMA-ES algorithms.
|
inline |
returns inverse root square of separable covariance diagonal matrix, only applicable to sep-CMA-ES algorithms.
sets new step-size value, use with care
sigma | step-size value |
sets the current distributions' mean in parameter space
xmean | mean vector |
|
inline |
returns current value of step-size sigma
|
inline |
number of candidate solutions.
|
inline |
returns current optimization status' message.
|
inline |
cmaparams | parameter object that hold the genotype/phenotype transform |
void libcmaes::CMASolutions::update_best_candidates | ( | ) |
updates the history of best candidates, as well as other meaningful values, typically used in termination criteria.
updates reference eigenvalue and eigenvectors, for use in termination criteria.
|
inline |
returns whether the last update is lazy
|
inline |
returns current distribution's mean in parameter space
|
private |
history of best candidate solutions.
|
private |
best seen candidate along the run.
|
private |
best function values over the past 20 steps, for termination criteria.
|
private |
current set of candidate solutions.
|
private |
temporary set of candidates used by uncertainty handling scheme.
|
private |
covariance matrix.
|
private |
expected vertical distance to the minimum.
|
private |
eigenvalues computation last step, lazy-update only.
|
private |
time consumed during last iteration.
|
private |
final elapsed time of stochastic optimization.
|
private |
0 or 1.
|
private |
k-th best candidate history, for termination criteria, k is kcand=1+floor(0.1+lambda/4).
|
private |
number of reevaluated solutions at current step.
|
private |
last computed eigenvalues, for termination criteria.
|
private |
last computed eigenvectors, for termination criteria.
|
private |
max eigenvalue, for termination criteria.
|
private |
max size of the history, keeps memory requirements fixed.
|
private |
median function values of some steps, in the past, for termination criteria.
|
private |
min eigenvalue, for termination criteria.
|
private |
number of function calls to reach the current solution.
|
private |
number of iterations to reach this solution, for termination criteria.
|
private |
cumulation for covariance.
profile likelihood for parameters it has been computed for.
|
private |
cumulation for sigma.
|
private |
current status of the stochastic optimization (e.g. running, or stopped under termination criteria).
|
private |
inverse root square of covariance matrix.
|
private |
step size.
|
private |
uncertainty level computed by uncertainty handling procedure.
|
private |
complementary vector for use in vdcma.
|
private |
distribution mean.
|
private |
previous step's mean vector.