QMCPACK
HybridEngine.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2019 QMCPACK developers.
6 //
7 // File developed by: Leon Otis, leon_otis@berkeley.edu University, University of California Berkeley
8 // Ye Luo, yeluo@anl.gov, Argonne National Laboratory
9 //
10 // File created by: Leon Otis, leon_otis@berkeley.edu University, University of California Berkeley
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 //Code for an engine to handle hybrid optimization
14 
15 
16 #ifndef QMCPLUSPLUS_HYBRID_ENGINE_HEADER
17 #define QMCPLUSPLUS_HYBRID_ENGINE_HEADER
18 
19 #include <vector>
20 #include <libxml/tree.h>
21 #include "Message/Communicate.h"
22 #include "VariableSet.h"
24 
25 
26 namespace qmcplusplus
27 {
29 {
32 
33 private:
35 
36 
37  ///number of optimization steps taken
38  int step_num_;
39 
40  ///process xml node
41  bool processXML(const xmlNodePtr cur);
42 
43  ///list of methods known by hybrid
44  std::vector<OptimizerType> opt_methods_;
45 
46  ///xml saved node
47  std::vector<xmlNodePtr> saved_xml_opt_methods_;
48 
49  //number of updates in each individual method of hybrid method
50  std::vector<int> num_updates_opt_methods_;
51 
52  //Helper method for determining the index in opt_methods_ that corresponds to a method based on current step
53  int identifyMethodIndex() const;
54 
55 public:
56  //Constructor for engine
57  HybridEngine(Communicate* comm, const xmlNodePtr cur);
58 
59  //Fake constructor only used in unit test for hybrid engine.
61 
62  //Returns the appropriate XML for a optimization method to be handled inside QMCFixedSampleLinearOptimize
63  xmlNodePtr getSelectedXML();
64 
65  //Increments the counter for steps taken within a hybrid method optimization
67 
68  //Determines whether to store a vector based on how many have been requested and what the current step is
69  bool queryStore(int store_num, OptimizerType method_type) const;
70 
71  //adds an optimization method to list. Used only in unit test for hybrid engine.
72  void addMethod(OptimizerType method) { opt_methods_.push_back(method); }
73 
74  //adds a number of update steps to list. Used only in unit test for hybrid engine.
75  void addUpdates(int num_steps) { num_updates_opt_methods_.push_back(num_steps); }
76 };
77 
78 } // namespace qmcplusplus
79 #endif
std::vector< xmlNodePtr > saved_xml_opt_methods_
xml saved node
Definition: HybridEngine.h:47
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
void addUpdates(int num_steps)
Definition: HybridEngine.h:75
std::vector< int > num_updates_opt_methods_
Definition: HybridEngine.h:50
void addMethod(OptimizerType method)
Definition: HybridEngine.h:72
int step_num_
number of optimization steps taken
Definition: HybridEngine.h:38
Wrapping information on parallelism.
Definition: Communicate.h:68
qmcplusplus::QMCTraits::ValueType ValueType
Definition: HybridEngine.h:31
QTFull::ValueType FullPrecValueType
Definition: Configuration.h:67
QTBase::ValueType ValueType
Definition: Configuration.h:60
std::vector< OptimizerType > opt_methods_
list of methods known by hybrid
Definition: HybridEngine.h:44
qmcplusplus::QMCTraits::FullPrecValueType FullPrecValueType
Definition: HybridEngine.h:30
bool processXML(const xmlNodePtr cur)
process xml node
bool queryStore(int store_num, OptimizerType method_type) const