00001 /** 00002 * \file CartesianProductSampler.h 00003 * \brief The class samples all combinations 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] to particles [a,b,c,d] the sampling space would be: 00007 * [1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,1,4],......,[5,5,5,4],[5,5,5,5] 00008 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00009 */ 00010 #ifndef IMPDOMINO_CARTESIAN_PRODUCT_SAMPLER_H 00011 #define IMPDOMINO_CARTESIAN_PRODUCT_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 "MappedDiscreteSet.h" 00019 #include <algorithm> 00020 00021 IMPDOMINO_BEGIN_NAMESPACE 00022 00023 //! CartesianProductSampler 00024 /** 00025 The class samples all combinations in a discrete set 00026 to particles. for example, in the case of anchor points each anchor point can be 00027 mapped to one particle for a specific mapping. For example, for anchor points 00028 [1,2,3,4,5] to particles [a,b,c,d] the sampling space would be: 00029 [1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,1,4],......,[5,5,5,4],[5,5,5,5] 00030 */ 00031 class IMPDOMINOEXPORT CartesianProductSampler : public DiscreteSampler 00032 { 00033 public: 00034 CartesianProductSampler(){} 00035 //! Create a combination sampler. 00036 /** 00037 \param[in] ds the discrete sampling space 00038 \param[in] ps the sampled particles 00039 */ 00040 CartesianProductSampler(MappedDiscreteSet *ds, const Particles &ps); 00041 void show(std::ostream& out = std::cout) const; 00042 void populate_states_of_particles(Particles *particles, 00043 std::map<std::string, CombState *> *states) const; 00044 virtual void move2state(const CombState *cs); 00045 DiscreteSet* get_space(Particle *p) const; 00046 protected: 00047 MappedDiscreteSet *ds_; 00048 Particles ps_; 00049 }; 00050 00051 IMPDOMINO_END_NAMESPACE 00052 00053 #endif /* IMPDOMINO_CARTESIAN_PRODUCT_SAMPLER_H */