EuclidianDistanceConnectionPredicate.h

Go to the documentation of this file.
00001 
00010 #ifndef EUCLIDIANDISTANCECONNECTIONPREDICATE_H
00011 #define EUCLIDIANDISTANCECONNECTIONPREDICATE_H
00012 
00013 #include <ConnectionDecisionPredicateSpecialization.h>
00014 
00016 
00020 class EuclidianDistanceConnectionPredicate : public SpatialConnectionDecisionPredicate {
00021 
00022     public:
00023 
00025         EuclidianDistanceConnectionPredicate( double C, double lambda )
00026                 : C(C), L2(lambda*lambda), unirnd(0.0,1.0) { /* NOOP */
00027         };
00028 
00030 
00033         virtual bool decide( size_t src, size_t dst, RandomEngine *rnd ) {
00034             return ( unirnd(*rnd) < C * exp( - sqr_distance( m_sourcePopulation->getLocation(src), m_destinationPopulation->getLocation(dst) ) / L2 ) )
00035                    && ( m_sourcePopulation->getID(src) != m_destinationPopulation->getID(dst) );
00036         };
00037 
00038     private:
00039         double C;
00040         double L2;
00041         UniformDistribution unirnd;
00042 };
00043 
00044 #endif

Generated on Wed Jul 9 16:34:37 2008 for PCSIM by  doxygen 1.5.5