IMP  2.0.1
The Integrative Modeling Platform
kernel/Sampler.h
Go to the documentation of this file.
1 /**
2  * \file IMP/kernel/Sampler.h \brief Base class for all samplers.
3  *
4  * Copyright 2007-2013 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPKERNEL_SAMPLER_H
9 #define IMPKERNEL_SAMPLER_H
10 
11 #include <IMP/kernel/kernel_config.h>
12 #include "Model.h"
13 #include "Pointer.h"
14 #include "ConfigurationSet.h"
17 
18 IMPKERNEL_BEGIN_NAMESPACE
19 
20 //! Base class for all samplers.
21 /** A sampler takes a Model and searches for good configurations,
22  given the optimizeable parameters and the scoring function in
23  the Model and extra information that can be provided. Typically,
24  the current configuration of the model is ignore.
25 
26  Typically a sampler works by using one or more Optimizer
27  types to search for configurations which minimize the scoring
28  function.
29 */
30 class IMPKERNELEXPORT Sampler: public IMP::base::Object
31 {
32  OwnerPointer<Model> model_;
33  OwnerPointer<ScoringFunction> sf_;
34  public:
35  Sampler(Model *m, std::string name="Sampler %1%");
36 #ifndef IMP_DOXYGEN
37  ConfigurationSet *get_sample() const {
38  IMP_DEPRECATED_FUNCTION(create_sample);
39  return create_sample();
40  }
41 #endif
42  ConfigurationSet *create_sample() const;
43 
44  ScoringFunction *get_scoring_function() const {
45  return sf_;
46  }
47  void set_scoring_function(ScoringFunctionAdaptor sf);
48 
49  Model *get_model() const {return model_;}
50 
51 protected:
52  virtual ConfigurationSet* do_sample() const =0;
53 
54  // for the vtable
56  //! Subclasses should override this method
57 };
58 
60 
61 IMPKERNEL_END_NAMESPACE
62 
63 #endif /* IMPKERNEL_SAMPLER_H */