libcmaes
A C++11 library for stochastic optimization with CMA-ES
 All Classes Namespaces Functions Variables Typedefs
Public Member Functions | Friends | List of all members
libcmaes::CMASolutions Class Reference

Holder of the set of evolving solutions from running an instance of CMA-ES. More...

#include <cmasolutions.h>

Public Member Functions

 CMASolutions ()
 dummy constructor.
 
template<class TGenoPheno = GenoPheno<NoBoundStrategy>>
 CMASolutions (Parameters< TGenoPheno > &p)
 initializes solutions from stochastic optimization parameters. More...
 
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. More...
 
void update_eigenv (const dVec &eigenvalues, const dMat &eigenvectors)
 updates reference eigenvalue and eigenvectors, for use in termination criteria. More...
 
Candidate best_candidate () const
 returns current best solution candidate. NOTE: candidates MUST be sorted More...
 
Candidate get_best_seen_candidate () const
 returns the best seen candidate. More...
 
Candidate get_worst_seen_candidate () const
 returns the worst seen candidate. More...
 
Candidateget_candidate (const int &r)
 get a reference to the r-th candidate in current set More...
 
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. More...
 
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). More...
 
bool get_pli (const int &k, pli &p) const
 get profile likelihood if previously computed.
 
int dim () const
 return problem dimension. More...
 
double edm () const
 returns expected distance to minimum. More...
 
dMat cov () const
 returns error covariance matrix More...
 
const dMat & cov_ref () const
 returns reference to error covariance matrix More...
 
const double * cov_data () const
 returns pointer to covariance matrix array More...
 
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. More...
 
dMat sepcov () const
 returns separable covariance diagonal matrix, only applicable to sep-CMA-ES algorithms. More...
 
const dMat & sepcov_ref () const
 returns reference to separable covariance diagonal vector, only applicable to sep-CMA-ES algorithms. More...
 
const double * sepcov_data () const
 returns pointer to covariance diagnoal vector More...
 
dMat csqinv () const
 returns inverse root square of covariance matrix More...
 
dMat sepcsqinv () const
 returns inverse root square of separable covariance diagonal matrix, only applicable to sep-CMA-ES algorithms. More...
 
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 More...
 
double corr (const int &i, const int &j) const
 returns correlation between parameter i and j (useful in large-scale settings) More...
 
double sigma () const
 returns current value of step-size sigma More...
 
dVec xmean () const
 returns current distribution's mean in parameter space More...
 
void set_xmean (const dVec &xmean)
 sets the current distributions' mean in parameter space More...
 
int run_status () const
 returns current optimization status. More...
 
std::string status_msg () const
 returns current optimization status' message. More...
 
int elapsed_time () const
 returns currently elapsed time spent on optimization More...
 
int elapsed_last_iter () const
 returns time spent on last iteration More...
 
int niter () const
 returns current number of iterations More...
 
int nevals () const
 returns current budget (number of objective function calls) More...
 
double min_eigenv () const
 returns current minimal eigen value More...
 
double max_eigenv () const
 returns current maximal eigen value More...
 
bool updated_eigen () const
 returns whether the last update is lazy More...
 
int fevals () const
 returns current number of objective function evaluations More...
 
dVec eigenvalues () const
 returns last computed eigenvalues More...
 
dMat eigenvectors () const
 returns last computed eigenvectors More...
 
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. More...
 

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
 

Detailed Description

Holder of the set of evolving solutions from running an instance of CMA-ES.

Constructor & Destructor Documentation

template<class TGenoPheno >
libcmaes::CMASolutions::CMASolutions ( Parameters< TGenoPheno > &  p)

initializes solutions from stochastic optimization parameters.

Parameters
pparameters

Member Function Documentation

Candidate libcmaes::CMASolutions::best_candidate ( ) const
inline

returns current best solution candidate. NOTE: candidates MUST be sorted

Returns
current best candidate
See also
CMASolutions::sort_candidates
dMat libcmaes::CMASolutions::corr ( ) const

returns correlation matrix

Returns
correlation matrix
double libcmaes::CMASolutions::corr ( const int &  i,
const int &  j 
) const

returns correlation between parameter i and j (useful in large-scale settings)

Returns
correlation between parameter i and j
dMat libcmaes::CMASolutions::cov ( ) const
inline

returns error covariance matrix

Returns
error covariance matrix
const double* libcmaes::CMASolutions::cov_data ( ) const
inline

returns pointer to covariance matrix array

Returns
pointer to covariance matrix array
const dMat& libcmaes::CMASolutions::cov_ref ( ) const
inline

returns reference to error covariance matrix

Returns
error covariance matrix
dMat libcmaes::CMASolutions::csqinv ( ) const
inline

returns inverse root square of covariance matrix

Returns
square root of error covariance matrix
int libcmaes::CMASolutions::dim ( ) const
inline

return problem dimension.

Returns
problem dimension
double libcmaes::CMASolutions::edm ( ) const
inline

returns expected distance to minimum.

Returns
edm
dVec libcmaes::CMASolutions::eigenvalues ( ) const
inline

returns last computed eigenvalues

Returns
last computed eigenvalues
dMat libcmaes::CMASolutions::eigenvectors ( ) const
inline

returns last computed eigenvectors

Returns
last computed eigenvectors
int libcmaes::CMASolutions::elapsed_last_iter ( ) const
inline

returns time spent on last iteration

Returns
time spent on last iteration
int libcmaes::CMASolutions::elapsed_time ( ) const
inline

returns currently elapsed time spent on optimization

Returns
time spent on optimization
template<class TGenoPheno = GenoPheno<NoBoundStrategy>>
dVec libcmaes::CMASolutions::errors ( const CMAParameters< TGenoPheno > &  cmaparams) const
inline
Returns
standard deviation vector
Parameters
cmaparamsparameter object that hold the genotype/phenotype transform
Returns
standard deviation vector
int libcmaes::CMASolutions::fevals ( ) const
inline

returns current number of objective function evaluations

Returns
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.

Returns
full size covariance matrix
Candidate libcmaes::CMASolutions::get_best_seen_candidate ( ) const
inline

returns the best seen candidate.

Returns
best seen candidate
Candidate& libcmaes::CMASolutions::get_candidate ( const int &  r)
inline

get a reference to the r-th candidate in current set

Parameters
rcandidate position
Candidate libcmaes::CMASolutions::get_worst_seen_candidate ( ) const
inline

returns the worst seen candidate.

Returns
worst seen candidate
double libcmaes::CMASolutions::max_eigenv ( ) const
inline

returns current maximal eigen value

Returns
maximal eigen value
double libcmaes::CMASolutions::min_eigenv ( ) const
inline

returns current minimal eigen value

Returns
minimal eigen value
int libcmaes::CMASolutions::nevals ( ) const
inline

returns current budget (number of objective function calls)

Returns
number of objective function calls
int libcmaes::CMASolutions::niter ( ) const
inline

returns current number of iterations

Returns
number of iterations
template<class TGenoPheno >
template std::ostream & libcmaes::CMASolutions::print ( std::ostream &  out,
const int &  verb_level = 0,
const TGenoPheno &  gp = TGenoPheno() 
) const

print the solution object out.

Parameters
outoutput stream
verb_levelverbosity level: 0 for short, 1 for debug.
void libcmaes::CMASolutions::reset_as_fixed ( const int &  k)

re-arrange solution object such that parameter 'k' is fixed (i.e. removed).

Parameters
kindex of the parameter to remove.
int libcmaes::CMASolutions::run_status ( ) const
inline

returns current optimization status.

Returns
status
dMat libcmaes::CMASolutions::sepcov ( ) const
inline

returns separable covariance diagonal matrix, only applicable to sep-CMA-ES algorithms.

Returns
error covariance diagonal vector
const double* libcmaes::CMASolutions::sepcov_data ( ) const
inline

returns pointer to covariance diagnoal vector

Returns
pointer to covariance diagonal array
const dMat& libcmaes::CMASolutions::sepcov_ref ( ) const
inline

returns reference to separable covariance diagonal vector, only applicable to sep-CMA-ES algorithms.

Returns
error covariance diagonal vector
dMat libcmaes::CMASolutions::sepcsqinv ( ) const
inline

returns inverse root square of separable covariance diagonal matrix, only applicable to sep-CMA-ES algorithms.

Returns
square root of error covariance diagonal matrix
void libcmaes::CMASolutions::set_xmean ( const dVec &  xmean)
inline

sets the current distributions' mean in parameter space

Parameters
xmeanmean vector
double libcmaes::CMASolutions::sigma ( ) const
inline

returns current value of step-size sigma

Returns
current step-size
int libcmaes::CMASolutions::size ( ) const
inline

number of candidate solutions.

Returns
current number of solution candidates.
std::string libcmaes::CMASolutions::status_msg ( ) const
inline

returns current optimization status' message.

Returns
status message
template<class TGenoPheno = GenoPheno<NoBoundStrategy>>
dVec libcmaes::CMASolutions::stds ( const CMAParameters< TGenoPheno > &  cmaparams) const
inline
Returns
the unscaled standard deviation vector Note: this is only useful to compare amond standard deviations To get the true rescaled estimate of the error, use errors()
Parameters
cmaparamsparameter object that hold the genotype/phenotype transform
Returns
unscaled standard deviation vector
void libcmaes::CMASolutions::update_best_candidates ( )

updates the history of best candidates, as well as other meaningful values, typically used in termination criteria.

See also
CMAStopCriteria
void libcmaes::CMASolutions::update_eigenv ( const dVec &  eigenvalues,
const dMat &  eigenvectors 
)

updates reference eigenvalue and eigenvectors, for use in termination criteria.

See also
CMAStopCriteria
bool libcmaes::CMASolutions::updated_eigen ( ) const
inline

returns whether the last update is lazy

Returns
whether the last update is lazy
dVec libcmaes::CMASolutions::xmean ( ) const
inline

returns current distribution's mean in parameter space

Returns
mean

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