IMP logo
IMP Reference Guide  2.15.0
The Integrative Modeling Platform
SubsetMover.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/SubsetMover.h
3  * \brief A mover that applies a random subset of movers
4  *
5  * Copyright 2007-2021 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_SUBSET_MOVER_H
10 #define IMPCORE_SUBSET_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 //! Applies a subset of a list of movers
19 /** Each time a move is requested, a random fixed-length subset
20  of the list of moves is applied. Movers are sampled without
21  replacement with uniform probabilities.
22  */
23 class IMPCOREEXPORT SubsetMover : public MonteCarloMover {
24  MonteCarloMovers movers_;
25  unsigned int n_;
26  std::vector<unsigned int> subset_inds_;
27 
28  public:
29  /** Constructor.
30  \param[in] mvs list of movers
31  \param[in] n number of movers to be randomly chosen for subset
32  of moves
33  */
34  SubsetMover(const MonteCarloMoversTemp& mvs, unsigned int n);
35 
36  const MonteCarloMovers& get_movers() const { return movers_; }
37 
38  unsigned int get_subset_size() const { return n_; }
39 
40  protected:
43  virtual void do_reject() IMP_OVERRIDE;
44  virtual void do_accept() IMP_OVERRIDE;
46 };
47 
48 IMPCORE_END_NAMESPACE
49 
50 #endif /* IMPCORE_SUBSET_MOVER_H */
Simple Monte Carlo optimizer.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
virtual void do_accept()
Implement accept_proposed_move(); default implementation is empty.
Applies a subset of a list of movers.
Definition: SubsetMover.h:23
virtual void do_reject()=0
Implement reset_proposed_move()
Return value of the MonteCarloMover::propose() function.
A base class for classes which perturb particles.
The base class for movers for Monte Carlo optimization.
virtual MonteCarloMoverResult do_propose()=0
Implement propose_move()
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.