- Main Page
- Classes
- Files

- Search for |

# moeoOneObjectiveComparator.h

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 //-----------------------------------------------------------------------------
    00004 // moeoOneObjectiveComparator.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 MOEOONEOBJECTIVECOMPARATOR_H_
    00014 #define MOEOONEOBJECTIVECOMPARATOR_H_
    00015
    00016 #include <comparator/moeoComparator.h>
    00017
    00021 template < class MOEOT >
    00022 class moeoOneObjectiveComparator : public moeoComparator < MOEOT >
    00023 {
    00024 public:
    00025
    00030     moeoOneObjectiveComparator(unsigned int _obj) : obj(_obj)
    00031     {
    00032         if (obj > MOEOT::ObjectiveVector::nObjectives())
    00033         {
    00034             throw std::runtime_error("Problem with the index of objective in moeoOneObjectiveComparator");
    00035         }
    00036     }
    00037
    00038
    00044     const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
    00045     {
    00046         return _moeo1.objectiveVector()[obj] < _moeo2.objectiveVector()[obj];
    00047     }
    00048
    00049
    00050 private:
    00051
    00053     unsigned int obj;
    00054
    00055 };
    00056
    00057 #endif /*MOEOONEOBJECTIVECOMPARATOR_H_*/