- Main Page
- Classes
- Files

- Search for |

# moeoNormalizedSolutionVsSolutionBinaryMetric.h

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 //-----------------------------------------------------------------------------
    00004 // moeoNormalizedSolutionVsSolutionBinaryMetric.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 MOEONORMALIZEDSOLUTIONVSSOLUTIONBINARYMETRIC_H_
    00014 #define MOEONORMALIZEDSOLUTIONVSSOLUTIONBINARYMETRIC_H_
    00015
    00016 #include <vector>
    00017 #include <utils/eoRealBounds.h>
    00018 #include <metric/moeoMetric.h>
    00019
    00025 template < class ObjectiveVector, class R >
    00026 class moeoNormalizedSolutionVsSolutionBinaryMetric : public moeoSolutionVsSolutionBinaryMetric < ObjectiveVector, R >
    00027 {
    00028 public:
    00029
    00033     moeoNormalizedSolutionVsSolutionBinaryMetric()
    00034     {
    00035         bounds.resize(ObjectiveVector::Traits::nObjectives());
    00036         // initialize bounds in case someone does not want to use them
    00037         for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++)
    00038         {
    00039             bounds[i] = eoRealInterval(0,1);
    00040         }
    00041     }
    00042
    00043
    00050     void setup(double _min, double _max, unsigned int _obj)
    00051     {
    00052         if (_min == _max)
    00053         {
    00054             _min -= tiny();
    00055             _max += tiny();
    00056         }
    00057         bounds[_obj] = eoRealInterval(_min, _max);
    00058     }
    00059
    00060
    00066     virtual void setup(eoRealInterval _realInterval, unsigned int _obj)
    00067     {
    00068         bounds[_obj] = _realInterval;
    00069     }
    00070
    00071
    00075     static double tiny()
    00076     {
    00077         return 1e-6;
    00078     }
    00079
    00080
    00081 protected:
    00082
    00084     std::vector < eoRealInterval > bounds;
    00085
    00086 };
    00087
    00088 #endif /*MOEONORMALIZEDSOLUTIONVSSOLUTIONBINARYMETRIC_H_*/