Rosetta 3.5
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
protocols
pack_daemon
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
19
#include <
protocols/pack_daemon/MultistateFitnessFunction.fwd.hh
>
20
#include <
protocols/pack_daemon/MultistateAggregateFunction.fwd.hh
>
21
22
// Package headers
23
// AUTO-REMOVED #include <protocols/pack_daemon/EntityCorrespondence.fwd.hh>
24
#include <
protocols/pack_daemon/PackDaemon.fwd.hh
>
25
26
// Project headers
27
#include <
core/pose/Pose.fwd.hh
>
28
#include <
protocols/genetic_algorithm/FitnessFunction.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
42
class
MultistateFitnessFunction
:
public
protocols::genetic_algorithm::FitnessFunction
43
{
44
public
:
45
typedef
protocols::genetic_algorithm::FitnessFunction
parent
;
46
typedef
protocols::genetic_algorithm::Entity
Entity
;
47
typedef
protocols::genetic_algorithm::EntityOP
EntityOP
;
48
typedef
utility::vector1< core::Real >
StateEnergies
;
49
typedef
std::pair< StateEnergies, StateEnergies >
StateEnergiesAndNPDs
;
50
typedef
std::pair< EntityOP, StateEnergiesAndNPDs >
EntityAndScore
;
51
typedef
utility::vector1< EntityAndScore >
EntityHistory
;
52
typedef
core::pose::PoseOP
PoseOP
;
53
typedef
core::pose::Pose
Pose
;
54
typedef
core::Real
Real
;
55
typedef
core::Size
Size
;
56
57
public
:
58
MultistateFitnessFunction
();
59
virtual
~MultistateFitnessFunction
();
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
68
void
aggregate_function
(
MultistateAggregateFunctionOP
func );
69
70
DaemonSetCOP
daemon_set
()
const
;
71
MultistateAggregateFunctionCOP
aggregate_function
()
const
;
72
73
void
set_history_size
(
core::Size
history_size );
74
void
clear_history
();
75
76
std::list< std::pair< Size, PoseOP > >
77
recover_relevant_poses_for_entity
(
Entity
const
& );
78
79
protected
:
80
virtual
void
compute_state_energies
(
Entity
const
& entity );
81
virtual
core::Real
compute_aggregate_score
(
Entity
const
& entity );
82
83
virtual
void
instruct_daemons_to_keep_last_entity
();
84
virtual
void
instruct_daemons_to_drop_entity
(
Entity
const
& entity );
85
86
virtual
87
std::list< std::pair< Size, PoseOP > >
88
recover_poses_from_states
(
89
Entity
const
&,
90
utility::vector1< core::Size >
const
& which_states
91
);
92
93
// Read and write access for derived classes
94
utility::vector1< core::Real >
&
state_energies
();
95
utility::vector1< core::Real >
&
npd_properties
();
96
97
DaemonSetOP
daemon_set
();
98
MultistateAggregateFunctionOP
aggregate_function
();
99
100
Size
which_top_entity
(
Entity
const
& ent )
const
;
101
102
void
update_entity_history
(
Entity
const
& ent );
103
104
private
:
105
106
DaemonSetOP
daemon_set_
;
107
StateEnergies
state_energies_
;
108
StateEnergies
npd_properties_
;
109
MultistateAggregateFunctionOP
aggregate_
;
110
111
Size
desired_entity_history_size_
;
112
Size
n_tied_for_worst_
;
113
EntityHistory
top_entities_
;
// use STL heap operations
114
115
};
116
117
class
MPIMultistateFitnessFunction
:
public
MultistateFitnessFunction
118
{
119
public
:
120
MPIMultistateFitnessFunction
();
121
virtual
~MPIMultistateFitnessFunction
();
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.
151
virtual
void
instruct_daemons_to_keep_last_entity
();
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 > >
162
recover_poses_from_states
(
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
:
172
Size
MPI_nprocs_
;
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_;
177
utility::vector0< std::list< core::Real >
> npd_percentage_;
178
#endif
179
180
//DaemonSetOP local_daemon_set_;
181
182
};
183
184
185
}
186
}
187
188
#endif
Generated on Sat Jun 1 2013 12:02:25 for Rosetta 3.5 by
1.8.4