IMP  2.0.1
The Integrative Modeling Platform
SerialMover.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/SerialMover.h
3  * \brief A mover that apply other movers one at a time
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_SERIAL_MOVER_H
10 #define IMPCORE_SERIAL_MOVER_H
11 
12 #include <IMP/core/core_config.h>
13 #include "MonteCarlo.h"
14 #include "MonteCarloMover.h"
15 
16 IMPCORE_BEGIN_NAMESPACE
17 
18 //! Apply a list of movers one at a time
19 /** Each time a move is requested, on the next mover is applied. This
20  should probably be used in conjunction with incremental scoring
21  (MonteCarlo::set_use_incremental()).
22  */
23 class IMPCOREEXPORT SerialMover : public MonteCarloMover
24 {
25  int imov_;
26  MonteCarloMovers movers_;
27 public:
28  /** The Serial are applied one at a time
29  \param[in] mvs list of movers to apply one after another
30  */
32 
33  const MonteCarloMovers& get_movers() const {
34  return movers_;
35  }
36 
37 #ifndef IMP_DOXYGEN
39  double get_acceptance_probability(int i) const {
40  return static_cast<double>(movers_[i]->get_number_of_accepted())/
41  movers_[i]->get_number_of_proposed();
42  }
44  void reset_acceptance_probabilities() {
45  for (unsigned int i = 0; i < movers_.size(); ++i) {
46  movers_[i]->reset_statistics();
47  }
48  }
50  unsigned int get_number_of_movers() const {
51  return movers_.size();
52  }
53 #endif
54 protected:
55  virtual kernel::ModelObjectsTemp do_get_inputs() const IMP_OVERRIDE;
56  virtual MonteCarloMoverResult do_propose() IMP_OVERRIDE;
57  virtual void do_reject() IMP_OVERRIDE;
58  virtual void do_accept() IMP_OVERRIDE;
60 };
61 
62 IMPCORE_END_NAMESPACE
63 
64 #endif /* IMPCORE_SERIAL_MOVER_H */