16 #ifndef QMCPLUSPLUS_DESCENT_ENGINE_HEADER 17 #define QMCPLUSPLUS_DESCENT_ENGINE_HEADER 22 #include <libxml/tree.h> 252 void prepareStorage(
const int num_replicas,
const int num_optimizables);
268 const std::vector<FullPrecValueType>& der_rat_samp,
269 const std::vector<FullPrecValueType>& le_der_samp,
270 const std::vector<FullPrecValueType>& ls_der_samp,
285 std::vector<ValueType>& weights,
286 std::vector<ValueType>& numerSamples,
287 std::vector<ValueType>& denomSamples,
312 void storeVectors(std::vector<ValueType>& current_params);
317 std::vector<ValueType>& numerSamples,
318 std::vector<ValueType>& denomSamples);
int num_params_
Number of optimizable parameters.
const std::vector< ValueType > & getAveragedDerivatives() const
Returns the derivatives of the cost function we are minimizing.
std::vector< std::vector< ValueType > > deriv_records_
Vector for storing Lagrangian derivatives from previous optimization steps.
DescentEngine(Communicate *comm, const xmlNodePtr cur)
Constructor for engine.
int getDescentNum() const
Returns number of optimization steps that have been taken with descent.
Communicate * my_comm_
Communicator handles MPI reduction.
std::vector< std::vector< ValueType > > replica_final_tnv_history_
std::vector< ValueType > final_tar_var_history_
a vector to store the variances of the target function during the descent finalization phase ...
std::vector< ValueType > final_tdv_history_
a history of target function denomerator times the |value/guiding|^2 ratios during the descent finali...
int store_count_
Counter of how many vectors have been stored so far.
ValueType getOmega() const
Returns current value of omega.
std::vector< ValueType > final_vg_history_
history of sampled |value/guiding|^2 ratios during the descent finalization phase ...
helper functions for EinsplineSetBuilder
ValueType numer_err_
Standard error of the target function numerator.
int final_descent_num_
Counter for the number of descent steps taken in the finalization phase.
std::vector< ValueType > tnv_history_
a history of target function numerator times the |value/guiding|^2 ratios for one iteration ...
int ramp_num_
Number of steps over which to ramp up step size.
std::vector< ValueType > denom_records_
Vector for storing step size denominator values from previous optimization step.
QTBase::RealType RealType
void sample_finish()
Function that reduces all vector information from all processors to the root processor.
qmcplusplus::QMCTraits::RealType RealType
std::vector< ValueType > taus_
Vector for storing step sizes from previous optimization step.
ValueType tjf_2body_eta_
Step sizes for different types of parameters.
std::vector< std::vector< FullPrecValueType > > replica_denom_der_samp_
Vector for target function denominator parameter derivatives on one thread.
std::vector< ValueType > vg_history_
history of sampled |value/guiding|^2 ratios for one iteration
int store_num_
Number of parameter difference vectors stored when descent is used in a hybrid optimization.
ValueType target_avg_
Average target function value on a descent step.
std::vector< std::vector< ValueType > > replica_final_w_history_
ValueType denom_avg_
Average target function denominator on a descent step.
void setupUpdate(const optimize::VariableSet &my_vars)
helper method for transferring information on parameter names and types to the engine ...
std::vector< ValueType > final_le_avg_history_
a vector to store the averages of the energy during the descent finalization phase ...
std::vector< std::vector< FullPrecValueType > > replica_numer_der_samp_
Vector for target function numerator parameter derivatives on one thread.
int collection_step_
Iteration to start collecting samples for final average and error blocking analysis.
ValueType denom_err_
Standard error of the target function denominator.
std::vector< ValueType > tdv_history_
a history of target function denominator times the |value/guiding|^2 ratios for one iteration ...
std::vector< int > engine_param_types_
void updateParameters()
helper method for updating parameter values with descent
void resetStorageCount()
Resets the number of vectors stored to 0 for next hybrid method macro-iteration.
std::vector< FullPrecValueType > avg_le_der_samp_
Vector for local energy parameter derivatives.
std::vector< std::vector< ValueType > > hybrid_blm_input_
Vector for storing the input vectors to the BLM steps of hybrid method.
ValueType getEnergy() const
Returns value of average energy.
void prepareStorage(const int num_replicas, const int num_optimizables)
Prepare for taking samples.
ValueType e_err_
Standard error of the energy.
std::vector< FullPrecValueType > avg_denom_der_samp_
Vector for target function denominator parameter derivatives.
std::vector< FullPrecValueType > avg_numer_der_samp_
Vector for target function numerator parameter derivatives.
std::vector< FullPrecValueType > avg_der_rat_samp_
Vector for WF parameter derivatives.
bool engine_target_excited_
Whether to target excited state.
std::vector< std::vector< ValueType > > replica_final_lev_history_
Wrapping information on parallelism.
ValueType denom_var_
Variance of the target function denominator.
std::vector< std::vector< ValueType > > replica_tnv_history_
std::vector< ValueType > lderivs_
Vector that stores the final averaged derivatives of the cost function.
int compute_step_
Iteration to start computing averages and errors from the stored values during the finalization phase...
std::vector< ValueType > w_history_
history of sampled configuration weights for one iteration
std::vector< std::vector< ValueType > > replica_lev_history_
QTFull::ValueType FullPrecValueType
std::vector< std::string > engine_param_names_
Vectors of parameter names and types, used in the assignment of step sizes.
std::vector< ValueType > final_w_history_
history of sampled configuration weights during descent finalization phase
QTBase::ValueType ValueType
std::vector< std::vector< ValueType > > replica_tdv_history_
ValueType setStepSize(int i)
helper method for seting step sizes for different parameter types in descent optimization ...
ValueType e_sd_
Standard deviation of the energy.
std::vector< ValueType > params_copy_
Vector for storing parameter values from previous optimization step.
std::vector< ValueType > current_params_
Vector for storing parameter values for current optimization step.
const std::vector< std::vector< ValueType > > & retrieveHybridBLM_Input() const
Returns the set of stored parameter difference vectors that will be given to the BLM.
const std::vector< ValueType > & retrieveNewParams() const
Returns the current set of parameter values.
class to handle a set of variables that can be modified during optimizations
ValueType target_var_
Variance of the target function.
void computeFinalizationUncertainties(std::vector< ValueType > &weights, std::vector< ValueType > &numerSamples, std::vector< ValueType > &denomSamples)
Compute uncertainties for energy/target function and variance over a history of samples from a set of...
std::vector< ValueType > final_var_avg_history_
a vector to store the variances of the energy during the descent finalization phase ...
ValueType getVariance() const
Returns variance of the energy.
std::vector< ValueType > final_tar_avg_history_
a vector to store the averages of the target function during the descent finalization phase ...
qmcplusplus::QMCTraits::FullPrecRealType FullPrecRealType
ValueType w_sum_
Total sum of weights.
void storeDerivRecord()
stores derivatives so they can be used in accelerated descent algorithm on later iterations ...
bool processXML(const xmlNodePtr cur)
process xml node
ValueType numer_avg_
Average target function numerator on a descent step.
bool targetingExcited() const
Returns whether an excited state is being targeted.
ValueType e_avg_
Average energy on a descent step.
qmcplusplus::QMCTraits::ValueType ValueType
std::vector< ValueType > final_lev_history_
history of sampled local energies times the |value/guiding|^2 raitos during the descent finalization ...
ValueType omega_
Value of omega in excited state functional.
bool ramp_eta_
Whether to gradually ramp up step sizes in descent.
std::vector< std::vector< FullPrecValueType > > replica_le_der_samp_
Vector for local energy parameter derivatives on one thread.
std::vector< ValueType > derivs_squared_
Vector for storing running average of squares of the derivatives.
std::vector< ValueType > params_for_diff_
Vector for storing parameter values for calculating differences to be given to hybrid method...
int descent_num_
Integer for keeping track of only number of descent steps taken.
LatticeGaussianProduct::ValueType ValueType
int getFinalDescentNum() const
Returns the descent iteration number when on a finalizing descent section.
ValueType getSD() const
Returns standard deviation of energy.
QTFull::RealType FullPrecRealType
bool collect_count_
Whether to start collecting samples for the histories in the finalization phase.
void mpi_unbiased_ratio_of_means(int numSamples, std::vector< ValueType > &weights, std::vector< ValueType > &numerSamples, std::vector< ValueType > &denomSamples, ValueType &mean, ValueType &variance, ValueType &stdErr)
Function for computing ratios of the form <f>/<g> as well as the associated variance and standard err...
ValueType lambda_
Parameter for accelerated descent recursion relation.
std::vector< std::vector< FullPrecValueType > > replica_der_rat_samp_
Vector for WF parameter derivatives on one thread.
void storeVectors(std::vector< ValueType > ¤t_params)
Store a vector of parameter differences to be used by the BLM in a hybrid optimization.
std::vector< std::vector< ValueType > > replica_final_vg_history_
std::vector< std::vector< ValueType > > replica_final_tdv_history_
qmcplusplus::QMCTraits::FullPrecValueType FullPrecValueType
std::string flavor_
What variety of gradient descent will be used.
std::vector< ValueType > lev_history_
a history of sampled local energies times the |value/guiding|^2 raitos for one iteration ...
ValueType e_var_
Variance of the energy.
void takeSample(const int replica_id, const std::vector< FullPrecValueType > &der_rat_samp, const std::vector< FullPrecValueType > &le_der_samp, const std::vector< FullPrecValueType > &ls_der_samp, ValueType vgs_samp, ValueType weight_samp)
Function that Take Sample Data from the Host Code.
void setDerivs(std::vector< ValueType > &test_derivs)
Function for setting averaged derivatives, currently only used as part of a unit test of the engine's...
std::string print_deriv_
Whether to print out derivative terms for each parameter.
ACC::value_type mean(const ACC &ac)
std::vector< ValueType > numer_records_
Vector for storing step size numerator values from previous optimization step.
std::vector< std::vector< ValueType > > replica_w_history_
int retrieveStoreFrequency() const
Returns number of times a parameter difference vector will be stored in the optimization.
ValueType target_err_
Standard error of the target function.
std::vector< std::vector< ValueType > > replica_vg_history_
ValueType numer_var_
Variance of the target function numerator.
std::vector< ValueType > final_tnv_history_
a history of target function numerator times the |value/guiding|^2 ratios during the descent finaliza...
void setParamVal(int index, ValueType value)
Function for setting parameter value, used to keep descent parameter values up to date with changes t...