- Main Page
- Classes
- Files

- Search for |

# moeoObjectiveObjectiveVectorComparator.h

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 //-----------------------------------------------------------------------------
    00004 // moeoObjectiveObjectiveVectorComparator.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 MOEOOBJECTIVEOBJECTIVEVECTORCOMPARATOR_H_
    00014 #define MOEOOBJECTIVEOBJECTIVEVECTORCOMPARATOR_H_
    00015
    00016 #include <comparator/moeoObjectiveVectorComparator.h>
    00017
    00021 template < class ObjectiveVector >
    00022 class moeoObjectiveObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector >
    00023 {
    00024 public:
    00025
    00031     const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
    00032     {
    00033         for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
    00034         {
    00035             if ( fabs(_objectiveVector1[i] - _objectiveVector2[i]) > ObjectiveVector::Traits::tolerance() )
    00036             {
    00037                 if (_objectiveVector1[i] < _objectiveVector2[i])
    00038                 {
    00039                     return true;
    00040                 }
    00041                 else
    00042                 {
    00043                     return false;
    00044                 }
    00045             }
    00046         }
    00047         return false;
    00048     }
    00049
    00050 };
    00051
    00052 #endif /*MOEOOBJECTIVEOBJECTIVEVECTORCOMPARATOR_H_*/