IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
Sampler.h
Go to the documentation of this file.
1/**
2 * \file IMP/Sampler.h \brief Base class for all samplers.
3 *
4 * Copyright 2007-2022 IMP Inventors. All rights reserved.
5 *
6 */
7
8#ifndef IMPKERNEL_SAMPLER_H
9#define IMPKERNEL_SAMPLER_H
10
11#include <IMP/kernel_config.h>
12#include "Model.h"
13#include <IMP/Pointer.h>
14#include <IMP/Object.h>
15#include "ConfigurationSet.h"
18
19IMPKERNEL_BEGIN_NAMESPACE
20
21//! Base class for all samplers.
22/** A sampler takes a Model and searches for good configurations,
23 given the optimizable parameters and the scoring function in
24 the Model and extra information that can be provided. Typically,
25 the current configuration of the model is ignored.
26
27 Typically a sampler works by using one or more Optimizer
28 types to search for configurations which minimize the scoring
29 function.
30*/
31class IMPKERNELEXPORT Sampler : public IMP::Object {
34
35 public:
36 Sampler(Model *m, std::string name = "Sampler %1%");
37 ConfigurationSet *create_sample() const;
38
39 //! Return the scoring function that is being used
40 /** \throws ValueException if no scoring function was set
41 */
43 if (sf_) {
44 return sf_;
45 } else {
46 IMP_THROW("No scoring function was set. "
47 "Use Sampler::set_scoring_function() to set one.",
49 }
50 }
51
52 void set_scoring_function(ScoringFunctionAdaptor sf);
53
54 Model *get_model() const { return model_; }
55
56 protected:
57 virtual ConfigurationSet *do_sample() const = 0;
58
59 // for the vtable
61 //! Subclasses should override this method
62};
63
65
66IMPKERNEL_END_NAMESPACE
67
68#endif /* IMPKERNEL_SAMPLER_H */
Store a set of configurations of the model.
Storage of a model, its restraints, constraints and particles.
A shared base class to help in debugging and things.
A nullptr-initialized pointer to an IMP Object.
#define IMP_THROW(message, exception_name)
Throw an exception with a message.
A class to store a set of configurations of a model.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Common base class for heavy weight IMP objects.
Definition Object.h:111
Base class for all samplers.
Definition Sampler.h:31
ScoringFunction * get_scoring_function() const
Return the scoring function that is being used.
Definition Sampler.h:42
Represents a scoring function on the model.
An exception for an invalid value being passed to IMP.
Definition exception.h:136
Control display of deprecation information.
IMP::Vector< IMP::Pointer< Sampler > > Samplers
Definition Sampler.h:64
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Macros to help with reference counting.
#define IMP_REF_COUNTED_NONTRIVIAL_DESTRUCTOR(Name)
A smart pointer to a ref-counted Object that is a class member.
Definition Pointer.h:144