IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
EnsembleGenerator.h
Go to the documentation of this file.
1 /**
2  * \file IMP/multi_state/EnsembleGenerator.h
3  * \brief Enumeration of an ensemble of good scoring MultiStateModels
4  *
5  * \authors Dina Schneidman
6  * Copyright 2007-2022 IMP Inventors. All rights reserved.
7  *
8  */
9 
10 #ifndef IMPMULTI_STATE_ENSEMBLE_GENERATOR_H
11 #define IMPMULTI_STATE_ENSEMBLE_GENERATOR_H
12 
13 #include "MultiStateModel.h"
14 #include "MultiStateModelScore.h"
15 
16 IMPMULTISTATE_BEGIN_NAMESPACE
17 
18 // Ensemble is a set of multi-state models
19 typedef Vector<MultiStateModel> Ensemble;
20 
21 //! Enumeration of an ensemble of good scoring MultiStateModels
22 class IMPMULTISTATEEXPORT EnsembleGenerator {
23 public:
24  EnsembleGenerator(unsigned int population_size,
25  unsigned int best_k,
27  double min_weight_threshold=0.05);
28 
29  void generate(unsigned int multi_state_model_size);
30 
31 private:
32  void init();
33 
34  // enumerate MultiStateModels of size N from MultiStateModels of size N-1
35  void add_one_state(const Ensemble& init_ensemble, Ensemble& new_ensemble);
36 
37  void rescore(Ensemble& ensemble,
38  Ensemble& rescored_ensemble,
40 
41  void output(Ensemble& ensemble,
42  const Vector<Vector<saxs::WeightedFitParameters> >& fps) const;
43 
44  double get_score(const MultiStateModel& e) const {
45  double ret = 0;
46  for(unsigned int i=0; i<scorers_.size(); i++) {
47  ret += scorers_[i]->get_score(e);
48  }
49  return ret;
50  }
51 
52  void get_state_probabilities(const Ensemble& ensemble,
53  Vector<double>& state_prob) const;
54 
55  void get_weights_average_and_std(const Ensemble& ensemble,
57  Vector<double>& weights_average,
58  Vector<double>& weights_variance) const;
59 
60 private:
61  unsigned int N_;
62  unsigned int K_;
64  Vector<Ensemble > ensembles_;
65  double min_weight_threshold_; // default=5%
66 };
67 
68 IMPMULTISTATE_END_NAMESPACE
69 
70 #endif /* IMPMULTI_STATE_ENSEMBLE_GENERATOR_H */
Enumeration of an ensemble of good scoring MultiStateModels.
base class for MultiStateModel scoring classes
A more IMP-like version of the std::vector.
Definition: Vector.h:50
Keep track of multiple states.
Keep track of multiple states.