9 #ifndef IMPDOMINO_SUBSET_FILTERS_H
10 #define IMPDOMINO_SUBSET_FILTERS_H
12 #include <IMP/domino/domino_config.h>
25 #include <boost/dynamic_bitset.hpp>
29 #include <boost/pending/disjoint_sets.hpp>
31 IMPDOMINO_BEGIN_NAMESPACE
49 virtual bool get_is_ok(
const Assignment &state)
const = 0;
59 return state[pos] + 1;
92 virtual double get_strength(
const Subset &s,
93 const Subsets &prior_subsets)
const = 0;
135 const Subsets &excluded)
const;
140 int max_number_allowed_violations);
141 int get_maximum_number_of_violated_restraints()
const {
142 return max_violated_;
167 boost::vector_property_map<int> parent_, rank_;
168 mutable boost::disjoint_sets<boost::vector_property_map<int>,
169 boost::vector_property_map<int> > disjoint_sets_;
176 void build_sets()
const;
179 unsigned int get_number_of_sets()
const {
190 if (set_indexes_.find(p) == set_indexes_.end()) {
193 return set_indexes_.find(p)->second;
203 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
204 inline DisjointSetsSubsetFilterTable::DisjointSetsSubsetFilterTable(
207 inline DisjointSetsSubsetFilterTable::DisjointSetsSubsetFilterTable(
209 : SubsetFilterTable(name), disjoint_sets_(rank_, parent_) {}
255 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
259 mutable double num_ok_, num_test_;
261 void load_indexes(
const Subset &s,
Ints &indexes)
const;
263 const boost::dynamic_bitset<> &bs);
267 double get_ok_rate()
const {
return num_ok_ / num_test_; }
271 return pst_->get_particle_states(p)->get_number_of_particle_states();
274 "Particle " << p->get_name()
275 <<
" is unknown. It probably is not in the "
276 <<
" ParticleStatesTable. Boom.");
277 return states_[i].size();
343 IMPDOMINO_END_NAMESPACE
Include the correct headers to get the boost vector_property_map.
ParticleIndexes get_indexes(const ParticlesTemp &ps)
Ints get_index(const kernel::ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
Maintain an explicit list of what states each particle is allowed to have.
A nullptr-initialized pointer to an IMP Object.
virtual SubsetFilter * get_subset_filter(const Subset &s, const Subsets &prior_subsets) const =0
A beyesian infererence-based sampler.
A smart pointer to a ref-counted Object that is a class memeber.
A smart pointer to a reference counted object.
kernel::RestraintsTemp get_restraints(const Subset &s, const ParticleStatesTable *pst, const DependencyGraph &dg, kernel::RestraintSet *rs)
Filter a configuration of the subset using the kernel::Model thresholds.
Represent a subset of the particles being optimized.
Import IMP/kernel/macros.h in the namespace.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
A class to store an fixed array of same-typed values.
Various important macros for implementing decorators.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
virtual double get_strength(const Subset &s, const Subsets &prior_subsets) const =0
The strength is a rough metric of how this filter restricts the subset.
Various general useful macros for IMP.
Class to handle individual model particles.
Storage of a model, its restraints, constraints and particles.
Common base class for heavy weight IMP objects.
A beyesian infererence-based sampler.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Store a configuration of a subset.
A beyesian infererence-based sampler.
Import IMP/kernel/Configuration.h in the namespace.
Filter a configuration of the subset using the kernel::Model thresholds.
A shared base class to help in debugging and things.
virtual int get_next_state(int pos, const Assignment &state) const
Return a next possible acceptable state for the particle in pos.
A beyesian infererence-based sampler.
Declare an efficient stl-compatible map.
#define IMP_DISJOINT_SUBSET_FILTER_TABLE_DECL(Name)