eoSigBinaryFlight.h

00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 //-----------------------------------------------------------------------------
00004 // eoSigBinaryFlight.h
00005 // (c) OPAC 2007
00006 /*
00007     Contact: paradiseo-help@lists.gforge.inria.fr
00008  */
00009 //-----------------------------------------------------------------------------
00010 
00011 #ifndef EOSIGBINARYFLIGHT_H
00012 #define EOSIGBINARYFLIGHT_H
00013 
00014 //-----------------------------------------------------------------------------
00015 #include <eoBinaryFlight.h>
00016 //-----------------------------------------------------------------------------
00017 
00018 
00019 
00028 template < class POT > class eoSigBinaryFlight:public eoBinaryFlight < POT >
00029 {
00030 
00031 public:
00032 
00036     eoSigBinaryFlight (){}
00037 
00038 
00042     double sigmoid( double _value)
00043     {
00044         return(1/(1+ exp(- _value)));
00045 
00046     }
00047 
00052     void operator  () (POT & _po)
00053     {
00054 
00055         for (unsigned j = 0; j < _po.size (); j++)
00056         {
00057             double sigma=rng.uniform(1);
00058 
00059             if (sigma < sigmoid(_po.velocities[j]))
00060                 _po[j]=1;
00061             else
00062                 _po[j]=0;
00063         }
00064 
00065         // invalidate the fitness because the positions have changed
00066         _po.invalidate();
00067     }
00068 };
00069 
00070 
00071 
00072 #endif /*EOSIGBINARYFLIGHT_H */

Generated on Fri Jun 22 10:17:02 2007 for EO-PSO by  doxygen 1.4.7