IMP
2.1.0
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
assignment_tables.h
Go to the documentation of this file.
1
/**
2
* \file IMP/domino/assignment_tables.h
3
* \brief A beyesian infererence-based sampler.
4
*
5
* Copyright 2007-2013 IMP Inventors. All rights reserved.
6
*
7
*/
8
9
#ifndef IMPDOMINO_ASSIGNMENT_TABLES_H
10
#define IMPDOMINO_ASSIGNMENT_TABLES_H
11
12
#include "
particle_states.h
"
13
#include "
subset_filters.h
"
14
#include "
Assignment.h
"
15
#include "
Subset.h
"
16
#include <IMP/domino/domino_config.h>
17
#include "
assignment_containers.h
"
18
#include "
domino_macros.h
"
19
#include <
IMP/Sampler.h
>
20
#include <
IMP/macros.h
>
21
#include <
IMP/base/map.h
>
22
#include <boost/pending/disjoint_sets.hpp>
23
#if BOOST_VERSION > 103900
24
#include <boost/property_map/property_map.hpp>
25
#else
26
#include <boost/property_map.hpp>
27
#endif
28
29
IMPDOMINO_BEGIN_NAMESPACE
30
class
DominoSampler;
31
32
/** The base class for classes that create Assignments, one per
33
subset. The main method of interest is load_assignments()
34
which enumerates the assignments and loads them into an AssignmentContainer.
35
*/
36
class
IMPDOMINOEXPORT
AssignmentsTable
:
public
IMP::base::Object
{
37
public
:
38
AssignmentsTable
(std::string name =
"SubsetStatesTable %1%"
) :
Object
(name) {}
39
virtual
void
load_assignments(
const
Subset
&s,
40
AssignmentContainer
*ac)
const
= 0;
41
~
AssignmentsTable
();
42
};
43
44
IMP_OBJECTS
(
AssignmentsTable
,
AssignmentsTables
);
45
46
/** The produced states are filtered using the provided
47
SubsetFilterTable objects. The assignments are enumerated
48
and filtered in a straight forward manner.
49
*/
50
class
IMPDOMINOEXPORT
SimpleAssignmentsTable
:
public
AssignmentsTable
{
51
base::Pointer<ParticleStatesTable>
pst_;
52
SubsetFilterTables
sft_;
53
unsigned
int
max_;
54
55
public
:
56
SimpleAssignmentsTable
(
ParticleStatesTable
*pst,
57
const
SubsetFilterTables
&sft =
SubsetFilterTables
(),
58
unsigned
int
max =
59
std::numeric_limits<unsigned int>::max());
60
virtual
void
load_assignments(
const
IMP::domino::Subset
&s,
61
AssignmentContainer
*ac)
const
IMP_OVERRIDE;
62
IMP_OBJECT_METHODS
(
SimpleAssignmentsTable
);
63
};
64
65
/** The produced states are filtered using the provided
66
SubsetFilterTable objects. The assignments are enumerated
67
and filtered by recursively dividing the subset in half.
68
*/
69
class
IMPDOMINOEXPORT
RecursiveAssignmentsTable
:
public
AssignmentsTable
{
70
base::Pointer<ParticleStatesTable>
pst_;
71
SubsetFilterTables
sft_;
72
unsigned
int
max_;
73
74
public
:
75
RecursiveAssignmentsTable
(
ParticleStatesTable
*pst,
76
const
SubsetFilterTables
&sft =
77
SubsetFilterTables
(),
78
unsigned
int
max =
79
std::numeric_limits<unsigned int>::max());
80
virtual
void
load_assignments(
const
IMP::domino::Subset
&s,
81
AssignmentContainer
*ac)
const
IMP_OVERRIDE;
82
IMP_OBJECT_METHODS
(
RecursiveAssignmentsTable
);
83
};
84
85
/** Enumerate states based on provided ParticleStates
86
objects.
87
88
The produced states are filtered using the provided
89
SubsetFilterTable objects. Branch and bound is used
90
to try to make this process more efficient. To do that
91
the SubsetFilterTable::get_strength() method is used
92
to order the particles from most restricted to least
93
restricted.
94
*/
95
class
IMPDOMINOEXPORT
BranchAndBoundAssignmentsTable
:
public
AssignmentsTable
{
96
#if !defined(SWIG) && !defined(IMP_DOXYGEN)
97
/* MSVC/Sun gcc appears confused by a friend class in the anonymous namespace
98
*/
99
public
:
100
base::Pointer<ParticleStatesTable>
pst_;
101
SubsetFilterTables
sft_;
102
unsigned
int
max_;
103
#if IMP_HAS_CHECKS >= IMP_INTERNAL
104
IMP::base::map<kernel::Particle *, kernel::ParticlesTemp>
rls_;
105
#endif
106
#endif
107
public
:
108
BranchAndBoundAssignmentsTable
(
ParticleStatesTable
*pst,
109
const
SubsetFilterTables
&sft =
110
SubsetFilterTables
(),
111
unsigned
int
max =
112
std::numeric_limits<unsigned int>::max());
113
virtual
void
load_assignments(
const
IMP::domino::Subset
&s,
114
AssignmentContainer
*ac)
const
IMP_OVERRIDE;
115
IMP_OBJECT_METHODS
(
BranchAndBoundAssignmentsTable
);
116
};
117
118
/** Store a map of Assignments objects and return them on demand. This table
119
should be used when each subset is sampled using some other protocol
120
(eg Monte Carlo or molecular dynamics) and those states are then fed
121
in to domino.
122
*/
123
class
IMPDOMINOEXPORT
ListAssignmentsTable
:
public
AssignmentsTable
{
124
IMP::base::map<Subset, IMP::base::PointerMember<AssignmentContainer>
>
125
states_;
126
127
public
:
128
ListAssignmentsTable
(std::string name =
"ListSubsetStatesTable %1%"
);
129
/** There must not be any duplicates in the list */
130
void
set_assignments
(
const
Subset
&s,
AssignmentContainer
*lsc) {
131
states_[s] = lsc;
132
}
133
virtual
void
load_assignments(
const
IMP::domino::Subset
&s,
134
AssignmentContainer
*ac)
const
IMP_OVERRIDE;
135
IMP_OBJECT_METHODS
(
ListAssignmentsTable
);
136
};
137
138
/** Return the order computed for the particles in the subset to be used for
139
enumeration. This function is there in order to expose internal
140
functionality for easier testing and should not be depended upon.
141
*/
142
IMPDOMINOEXPORT
kernel::ParticlesTemp
get_order
(
const
Subset
&s,
143
const
SubsetFilterTables
&sft);
144
145
IMPDOMINO_END_NAMESPACE
146
147
#endif
/* IMPDOMINO_ASSIGNMENT_TABLES_H */
IMP::domino::AssignmentContainer
Definition:
assignment_containers.h:40
IMP::domino::get_order
kernel::ParticlesTemp get_order(const Subset &s, const SubsetFilterTables &sft)
IMP::domino::ListAssignmentsTable
Definition:
assignment_tables.h:123
Assignment.h
A beyesian infererence-based sampler.
IMP::domino::ListAssignmentsTable::set_assignments
void set_assignments(const Subset &s, AssignmentContainer *lsc)
Definition:
assignment_tables.h:130
IMP::base::Pointer
A smart pointer to a reference counted object.
Definition:
base/Pointer.h:87
subset_filters.h
A beyesian infererence-based sampler.
IMP::domino::BranchAndBoundAssignmentsTable
Definition:
assignment_tables.h:95
IMP::base::Object::Object
Object()
IMP::domino::Subset
Represent a subset of the particles being optimized.
Definition:
Subset.h:33
macros.h
Import IMP/kernel/macros.h in the namespace.
IMP::base::Vector
Definition:
base/Vector.h:37
IMP::domino::ParticleStatesTable
Definition:
particle_states.h:73
Sampler.h
Import IMP/kernel/Sampler.h in the namespace.
domino_macros.h
Various important macros for implementing decorators.
IMP::domino::RecursiveAssignmentsTable
Definition:
assignment_tables.h:69
IMP::domino::AssignmentsTable
Definition:
assignment_tables.h:36
IMP_OBJECT_METHODS
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition:
base/object_macros.h:25
IMP::base::Object
Common base class for heavy weight IMP objects.
Definition:
base/declare_Object.h:123
Subset.h
A beyesian infererence-based sampler.
IMP_OBJECTS
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Definition:
base/object_macros.h:77
IMP::domino::SubsetFilterTables
IMP::base::Vector< IMP::base::Pointer< SubsetFilterTable > > SubsetFilterTables
Definition:
subset_filters.h:341
IMP::base::map
Definition:
base/map.h:26
IMP::domino::SimpleAssignmentsTable
Definition:
assignment_tables.h:50
assignment_containers.h
A beyesian infererence-based sampler.
particle_states.h
A beyesian infererence-based sampler.
map.h
Declare an efficient stl-compatible map.