From 9eaec1761ad3e3e4e16578b3521fc9d4318800af Mon Sep 17 00:00:00 2001 From: canape Date: Fri, 25 Jan 2008 16:16:03 +0000 Subject: [PATCH] git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@907 331e1502-861f-0410-8da2-ba01fb791d7f --- trunk/paradiseo-moeo/src/core/MOEO.h | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/trunk/paradiseo-moeo/src/core/MOEO.h b/trunk/paradiseo-moeo/src/core/MOEO.h index 5b7061755..6910486a0 100644 --- a/trunk/paradiseo-moeo/src/core/MOEO.h +++ b/trunk/paradiseo-moeo/src/core/MOEO.h @@ -55,6 +55,39 @@ * Besides, note that, contrary to the mono-objective case (and to EO) where the fitness value of a solution is confused with its objective value, * the fitness value differs of the objectives values in the multi-objective case. */ + +/* + template < typename DataType, typename DataTypeEx > struct Wrapper { + + Wrapper() {} + + Wrapper( const DataType& data ) + : embededData( data ) {} + + Wrapper( const Wrapper& wrapper ) + : embededData( wrapper.embededData ), embededDataEx( wrapper.embededDataEx ) {} + + operator const DataType& () const { return embededData; } + + Wrapper& operator= ( const Wrapper& wrapper ) { + + embededData = wrapper.embededData; + embededDataEx = wrapper.embededDataEx; + return *this; + } + + Wrapper& operator= ( const DataType& data ) { + + embededData = data; + return *this; + } + + DataType embededData; + DataTypeEx embededDataEx; +}; + **/ + + template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity > class MOEO : public EO < MOEOObjectiveVector > { @@ -65,6 +98,7 @@ class MOEO : public EO < MOEOObjectiveVector > /** the fitness type of a solution */ typedef MOEOFitness Fitness; +// typedef Wrapper< MOEOFitness, MOEOObjectiveVector > Fitness; /** the diversity type of a solution */ typedef MOEODiversity Diversity; @@ -142,6 +176,8 @@ class MOEO : public EO < MOEOObjectiveVector > { throw std::runtime_error("invalid fitness in MOEO"); } +// const_cast< Fitness& >( fitnessValue ).embededDataEx = objectiveVectorValue; + return fitnessValue; } @@ -314,4 +350,6 @@ class MOEO : public EO < MOEOObjectiveVector > }; + + #endif /*MOEO_H_*/