00001 /** 00002 * \file PermutationSampler.h 00003 * \brief The class samples all permutations in a discrete set 00004 * to particles. Each anchor point can be mapped to one 00005 * particle for a specific mapping. For example, for anchor points 00006 * [1,2,3,4,5,6] to particles [a,b,c,d] the sampling space would be: 00007 * [1,2,3,4],[1,2,3,5],[1,2,3,6],[1,2,4,3],......,[6,5,4,2],[6,5,4,3] 00008 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00009 */ 00010 #ifndef IMPDOMINO_PERMUTATION_SAMPLER_H 00011 #define IMPDOMINO_PERMUTATION_SAMPLER_H 00012 00013 #include "IMP/Particle.h" 00014 #include <map> 00015 #include <sstream> 00016 #include "IMP/domino/DiscreteSampler.h" 00017 #include "IMP/base_types.h" 00018 #include "DiscreteSet.h" 00019 #include <algorithm> 00020 #include "boost/combination.hpp" 00021 00022 IMPDOMINO_BEGIN_NAMESPACE 00023 00024 //! Permutation sampler 00025 /** 00026 */ 00027 class IMPDOMINOEXPORT PermutationSampler : public DiscreteSampler 00028 { 00029 public: 00030 PermutationSampler(){} 00031 //! Create a permutation sampler. 00032 /** 00033 \param[in] ds the discrete sampling space 00034 \param[in] ps the sampled particles 00035 */ 00036 PermutationSampler(DiscreteSet *ds, const Particles &ps); 00037 void show(std::ostream& out = std::cout) const; 00038 void populate_states_of_particles(Particles *particles, 00039 std::map<std::string, CombState *> *states) const; 00040 void move2state(const CombState *cs); 00041 //! Show the sampling space of a single particle 00042 void show_space(Particle *p, 00043 std::ostream& out = std::cout) const {} 00044 DiscreteSet* get_space(Particle *p) const{return ds_;} 00045 protected: 00046 // void construct(); 00047 void clear(); 00048 DiscreteSet *ds_; 00049 Particles ps_; 00050 }; 00051 00052 IMPDOMINO_END_NAMESPACE 00053 00054 #endif /* IMPDOMINO_PERMUTATION_SAMPLER_H */