9 #ifndef IMPDOMINO_SUBSET_FILTERS_H
10 #define IMPDOMINO_SUBSET_FILTERS_H
12 #include <IMP/domino/domino_config.h>
21 #include <boost/unordered_map.hpp>
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_;
170 boost::unordered_map<const kernel::Particle *, int> index_;
172 mutable boost::unordered_map<const kernel::Particle *, int> set_indexes_;
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)
256 boost::unordered_map<kernel::Particle *, int> map_;
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();
299 boost::unordered_map<kernel::ParticlePair, IntPairs> allowed_;
343 IMPDOMINO_END_NAMESPACE
ParticleIndexes get_indexes(const ParticlesTemp &ps)
Include the correct headers to get the boost vector_property_map.
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.
virtual SubsetFilter * get_subset_filter(const Subset &s, const Subsets &prior_subsets) const =0
A Bayesian inference-based sampler.
A smart pointer to a ref-counted Object that is a class member.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
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.
A class to store an fixed array of same-typed values.
Object(std::string name)
Construct an object with the given name.
Various general useful macros for IMP.
Various important macros for implementing decorators.
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.
Class to handle individual model particles.
Storage of a model, its restraints, constraints and particles.
Common base class for heavy weight IMP objects.
A Bayesian inference-based sampler.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
A nullptr-initialized pointer to an IMP Object.
A shared base class to help in debugging and things.
Store a configuration of a subset.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
A Bayesian inference-based sampler.
Import IMP/kernel/Configuration.h in the namespace.
Filter a configuration of the subset using the kernel::Model thresholds.
virtual int get_next_state(int pos, const Assignment &state) const
Return a next possible acceptable state for the particle in pos.
A Bayesian inference-based sampler.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
#define IMP_DISJOINT_SUBSET_FILTER_TABLE_DECL(Name)