Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MultistateFitnessFunction.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file protocols/pack_daemon/MultistateFitnessFunction.hh
11 /// @brief declaration for class MultistateFitnessFunction to work with the PackDeamon classes
12 /// (not to be confused with J. Ashworth's MultiStateFitnessFunction class)
13 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
14 
15 #ifndef INCLUDED_protocols_pack_daemon_MultistateFitnessFunction_hh
16 #define INCLUDED_protocols_pack_daemon_MultistateFitnessFunction_hh
17 
18 // Unit headers
21 
22 // Package headers
23 // AUTO-REMOVED #include <protocols/pack_daemon/EntityCorrespondence.fwd.hh>
25 
26 // Project headers
27 #include <core/pose/Pose.fwd.hh>
29 
30 // Utility headers
31 // AUTO-REMOVED #include <utility/heap.fwd.hh>
32 #include <utility/vector1.hh>
33 #include <utility/vector0.hh>
34 
35 // C++ headers
36 #include <list>
37 
38 //Auto Headers
39 namespace protocols {
40 namespace pack_daemon {
41 
43 {
44 public:
49  typedef std::pair< StateEnergies, StateEnergies > StateEnergiesAndNPDs;
50  typedef std::pair< EntityOP, StateEnergiesAndNPDs > EntityAndScore;
54  typedef core::Real Real;
55  typedef core::Size Size;
56 
57 public:
60 
61  virtual core::Real evaluate( Entity & entity );
62 
63  StateEnergies const & state_energies() const;
64  StateEnergies const & npd_properties() const;
65 
66  void daemon_set( DaemonSetOP ds );
67 
69 
70  DaemonSetCOP daemon_set() const;
72 
73  void set_history_size( core::Size history_size );
74  void clear_history();
75 
76  std::list< std::pair< Size, PoseOP > >
78 
79 protected:
80  virtual void compute_state_energies( Entity const & entity );
81  virtual core::Real compute_aggregate_score( Entity const & entity );
82 
84  virtual void instruct_daemons_to_drop_entity( Entity const & entity );
85 
86  virtual
87  std::list< std::pair< Size, PoseOP > >
89  Entity const &,
90  utility::vector1< core::Size > const & which_states
91  );
92 
93  // Read and write access for derived classes
96 
99 
100  Size which_top_entity( Entity const & ent ) const;
101 
102  void update_entity_history( Entity const & ent );
103 
104 private:
105 
110 
113  EntityHistory top_entities_; // use STL heap operations
114 
115 };
116 
118 {
119 public:
122 
123  /// @brief Inform this MPIMultistateFitnessFunction how many PackDaemons
124  /// are running on all nodes (counting this one) which it may be unaware of.
125  void set_num_pack_daemons( Size n_daemons );
126 
127  /// @brief Inform this MPIMultistateFitnessFunction how many non-pairwise decomposable
128  /// properties will be computed for all states
129  void set_num_npd_properties( Size n_npd_properties );
130 
131 
132  /// @brief Spin down the other nodes. No entity evaluation may follow
133  /// the spin down call
134  void send_spin_down_signal();
135 
136 #ifdef APL_MEASURE_MSD_LOAD_BALANCE
137  void print_load_balance_statistics( std::ostream & ) const;
138  void reset_load_balance_statistics();
139 #endif
140 
141 protected:
142 
143  /// @brief Override the base class implementation by broadcasting the
144  /// entity to all slave nodes, and waiting for them to report the energies
145  /// from their PackDaemons for that entity. If this node has PackDaemons,
146  /// then it will evaluate their energies, too.
147  virtual void compute_state_energies( Entity const & entity );
148 
149  /// @brief Broadcast the instruction to DaemonSets on all other nodes to keep
150  /// the entity that was just evaluated.
152 
153  /// @brief Broadcast the instruction to DaemonSets on all other nodes to discard
154  /// an old entity which had been previously held on to.
155  virtual void instruct_daemons_to_drop_entity( Entity const & entity );
156 
157  //// @brief Broadcast the entity and the set of states that correspond to
158  /// a set of poses that are important. The entity had better still live
159  /// on the distant nodes.
160  virtual
161  std::list< std::pair< Size, PoseOP > >
163  Entity const &,
164  utility::vector1< core::Size > const & which_states
165  );
166 
167 private:
168 
169  void broadcast_entity_string( Entity const & entity );
170 
171 private:
173 
174 #ifdef APL_MEASURE_MSD_LOAD_BALANCE
175  utility::vector0< std::list< core::Real > > utilization_by_node_;
176  utility::vector0< std::list< core::Real > > packing_percentage_;
178 #endif
179 
180  //DaemonSetOP local_daemon_set_;
181 
182 };
183 
184 
185 }
186 }
187 
188 #endif