Correct templatized types across ObjectiveVector-dependant code
This commit is contained in:
parent
d507114a3f
commit
206f12e558
4 changed files with 13 additions and 11 deletions
|
|
@ -59,7 +59,7 @@ public:
|
|||
typedef typename ObjectiveVector::Type AtomType;
|
||||
|
||||
/// Ctor
|
||||
moeoHypContinue( const std::vector<AtomType> & _OptimVec, moeoArchive < MOEOT > & _archive, bool _normalize=true, AtomType _rho=1.1)
|
||||
moeoHypContinue( const std::vector<AtomType> & _OptimVec, moeoArchive < MOEOT > & _archive, bool _normalize=true, double _rho=1.1)
|
||||
: eoContinue<MOEOT>(), arch(_archive), metric(_normalize,_rho)
|
||||
{
|
||||
vectorToParetoSet(_OptimVec);
|
||||
|
|
|
|||
|
|
@ -33,17 +33,19 @@ Authors:
|
|||
|
||||
#include <comparator/moeoObjectiveObjectiveVectorComparator.h>
|
||||
#include <comparator/moeoParetoObjectiveVectorComparator.h>
|
||||
#include <core/moeoRealObjectiveVector.h>
|
||||
#include <core/moeoScalarObjectiveVector.h>
|
||||
|
||||
template < class ObjectiveVectorTraits >
|
||||
class moeoDualRealObjectiveVector : public moeoScalarObjectiveVector<ObjectiveVectorTraits, eoMinimizingDualFitness >
|
||||
template < class ObjectiveVectorTraits, class T = eoMinimizingDualFitness /* can be an eoMaximizingDualFitness */>
|
||||
class moeoDualRealObjectiveVector : public moeoScalarObjectiveVector<ObjectiveVectorTraits, T >
|
||||
{
|
||||
protected:
|
||||
bool _is_feasible;
|
||||
|
||||
public:
|
||||
|
||||
moeoDualRealObjectiveVector(double value=0.0) : moeoScalarObjectiveVector<ObjectiveVectorTraits, eoMinimizingDualFitness >(value, false) {}
|
||||
moeoDualRealObjectiveVector(double value=0.0)
|
||||
: moeoScalarObjectiveVector<ObjectiveVectorTraits, eoMinimizingDualFitness >
|
||||
( T(value, false) ) {}
|
||||
|
||||
bool is_feasible() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -151,8 +151,8 @@ class moeoScalarObjectiveVector : public moeoObjectiveVector < ObjectiveVectorTr
|
|||
* @param _os output stream
|
||||
* @param _objectiveVector the objective vector to write
|
||||
*/
|
||||
template < class ObjectiveVectorTraits >
|
||||
std::ostream & operator<<(std::ostream & _os, const moeoScalarObjectiveVector < ObjectiveVectorTraits > & _objectiveVector)
|
||||
template < class ObjectiveVectorTraits, class T >
|
||||
std::ostream & operator<<(std::ostream & _os, const moeoScalarObjectiveVector < ObjectiveVectorTraits, T > & _objectiveVector)
|
||||
{
|
||||
for (unsigned int i=0; i<_objectiveVector.size()-1; i++)
|
||||
_os << _objectiveVector[i] << " ";
|
||||
|
|
@ -165,10 +165,10 @@ std::ostream & operator<<(std::ostream & _os, const moeoScalarObjectiveVector <
|
|||
* @param _is input stream
|
||||
* @param _objectiveVector the objective vector to read
|
||||
*/
|
||||
template < class ObjectiveVectorTraits >
|
||||
std::istream & operator>>(std::istream & _is, moeoScalarObjectiveVector < ObjectiveVectorTraits > & _objectiveVector)
|
||||
template < class ObjectiveVectorTraits, class T >
|
||||
std::istream & operator>>(std::istream & _is, moeoScalarObjectiveVector < ObjectiveVectorTraits, T > & _objectiveVector)
|
||||
{
|
||||
_objectiveVector = moeoScalarObjectiveVector < ObjectiveVectorTraits > ();
|
||||
_objectiveVector = moeoScalarObjectiveVector < ObjectiveVectorTraits, T > ();
|
||||
for (unsigned int i=0; i<_objectiveVector.size(); i++)
|
||||
{
|
||||
_is >> _objectiveVector[i];
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ class moeoExpBinaryIndicatorBasedFitnessAssignment : public moeoBinaryIndicatorB
|
|||
*/
|
||||
void setup(const eoPop < MOEOT > & _pop)
|
||||
{
|
||||
double min, max;
|
||||
typename MOEOT::ObjectiveVector::Type min, max;
|
||||
for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++)
|
||||
{
|
||||
min = _pop[0].objectiveVector()[i];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue