moeoFitnessAssignment.h

00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 //-----------------------------------------------------------------------------
00004 // moeoFitnessAssignment.h
00005 // (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
00006 /*
00007     This library...
00008 
00009     Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
00010  */
00011 //-----------------------------------------------------------------------------
00012 
00013 #ifndef MOEOFITNESSASSIGNMENT_H_
00014 #define MOEOFITNESSASSIGNMENT_H_
00015 
00016 #include <eoFunctor.h>
00017 #include <eoPop.h>
00018 
00022 template < class MOEOT >
00023 class moeoFitnessAssignment : public eoUF < eoPop < MOEOT > &, void >
00024 {
00025 public:
00026 
00028     typedef typename MOEOT::ObjectiveVector ObjectiveVector;
00029 
00030 
00036     virtual void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) = 0;
00037 
00038 
00044     void updateByDeleting(eoPop < MOEOT > & _pop, MOEOT & _moeo)
00045     {
00046         updateByDeleting(_pop, _moeo.objectiveVector());
00047     }
00048 
00049 };
00050 
00051 
00055 template < class MOEOT >
00056 class moeoDummyFitnessAssignment : public moeoFitnessAssignment < MOEOT >
00057 {
00058 public:
00059 
00061     typedef typename MOEOT::ObjectiveVector ObjectiveVector;
00062 
00063 
00068     void operator () (eoPop < MOEOT > & _pop)
00069     {
00070         for (unsigned idx = 0; idx<_pop.size (); idx++)
00071         {
00072             if (_pop[idx].invalidFitness())
00073             {
00074                 // set the diversity to 0
00075                 _pop[idx].fitness(0.0);
00076             }
00077         }
00078     }
00079 
00080 
00086     void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
00087     {
00088         // nothing to do...  ;-)
00089     }
00090 
00091 };
00092 
00093 
00097 template < class MOEOT >
00098 class moeoScalarFitnessAssignment : public moeoFitnessAssignment < MOEOT >
00099     {};
00100 
00101 
00105 template < class MOEOT >
00106 class moeoCriterionBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
00107     {};
00108 
00109 
00113 template < class MOEOT >
00114 class moeoParetoBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
00115     {};
00116 
00117 
00118 #endif /*MOEOFITNESSASSIGNMENT_H_*/

Generated on Tue Apr 17 16:53:21 2007 for ParadisEO-MOEO by  doxygen 1.5.1