From 54e181d4603274f8b61e11c4d51c9183993504b2 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 7 Jun 2013 11:22:26 +0200 Subject: [PATCH] Use generic objective vector atomic type in HV continuator One should not use specific OV types in continuators, but get it from ObjectiveVector::Type instead. --- moeo/src/continue/moeoHypContinue.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/moeo/src/continue/moeoHypContinue.h b/moeo/src/continue/moeoHypContinue.h index 4e656bf69..9ecc5424e 100644 --- a/moeo/src/continue/moeoHypContinue.h +++ b/moeo/src/continue/moeoHypContinue.h @@ -56,15 +56,16 @@ class moeoHypContinue: public eoContinue public: typedef typename MOEOT::ObjectiveVector ObjectiveVector; + typedef typename ObjectiveVector::Type AtomType; /// Ctor - moeoHypContinue( const std::vector & _OptimVec, moeoArchive < MOEOT > & _archive, bool _normalize=true, double _rho=1.1) + moeoHypContinue( const std::vector & _OptimVec, moeoArchive < MOEOT > & _archive, bool _normalize=true, AtomType _rho=1.1) : eoContinue(), arch(_archive), metric(_normalize,_rho) { vectorToParetoSet(_OptimVec); } - moeoHypContinue( const std::vector & _OptimVec, moeoArchive < MOEOT > & _archive, bool _normalize=true, ObjectiveVector& _ref_point=NULL) + moeoHypContinue( const std::vector & _OptimVec, moeoArchive < MOEOT > & _archive, bool _normalize=true, ObjectiveVector& _ref_point=NULL) : eoContinue (), arch(_archive), metric(_normalize,_ref_point) { vectorToParetoSet(_OptimVec); @@ -79,7 +80,7 @@ public: bestCurrentParetoSet.push_back(arch[i].objectiveVector()); } - double hypervolume= metric(bestCurrentParetoSet,OptimSet ); + AtomType hypervolume= metric(bestCurrentParetoSet,OptimSet ); if (hypervolume==0) { eo::log << eo::logging << "STOP in moeoHypContinue: Best ParetoSet has been reached " @@ -90,7 +91,7 @@ public: } /** Translate a vector given as param to the ParetoSet that should be reached. */ - void vectorToParetoSet(const std::vector & _OptimVec) + void vectorToParetoSet(const std::vector & _OptimVec) { unsigned dim = (unsigned)(_OptimVec.size()/ObjectiveVector::Traits::nObjectives()); OptimSet.resize(dim);