minor changes

This commit is contained in:
okoenig 2003-04-05 13:42:44 +00:00
commit d51ee5916b

View file

@ -84,7 +84,7 @@ private:
with this quantity as if it were a ScalarType. with this quantity as if it were a ScalarType.
- Global fitness value is stored as first element in the vector - Global fitness value is stored as first element in the vector
*/ */
template <class ScalarType, class Compare, class FitnessTraits = eoScalarFitnessAssembledTraits > template <class ScalarType, class Compare, class FitnessTraits >
class eoScalarFitnessAssembled : public std::vector<ScalarType> { class eoScalarFitnessAssembled : public std::vector<ScalarType> {
public: public:
@ -176,13 +176,13 @@ public:
} }
// implementation of the other operators // implementation of the other operators
bool operator>( const eoScalarFitnessAssembled<ScalarType, Compare>& y ) const { return y < *this; } bool operator>( const eoScalarFitnessAssembled<ScalarType, Compare, FitnessTraits>& y ) const { return y < *this; }
// implementation of the other operators // implementation of the other operators
bool operator<=( const eoScalarFitnessAssembled<ScalarType, Compare>& y ) const { return !(*this > y); } bool operator<=( const eoScalarFitnessAssembled<ScalarType, Compare, FitnessTraits>& y ) const { return !(*this > y); }
// implementation of the other operators // implementation of the other operators
bool operator>=(const eoScalarFitnessAssembled<ScalarType, Compare>& y ) const { return !(*this < y); } bool operator>=(const eoScalarFitnessAssembled<ScalarType, Compare, FitnessTraits>& y ) const { return !(*this < y); }
}; };
@ -192,19 +192,19 @@ and minimizing fitness compares with greater. This because we want ordinary
fitness values (doubles) to be equivalent with Maximizing Fitness, and fitness values (doubles) to be equivalent with Maximizing Fitness, and
comparing with less is the default behaviour. comparing with less is the default behaviour.
*/ */
typedef eoScalarFitnessAssembled<double, std::less<double> > eoAssembledMaximizingFitness; typedef eoScalarFitnessAssembled<double, std::less<double>, eoScalarFitnessAssembledTraits > eoAssembledMaximizingFitness;
typedef eoScalarFitnessAssembled<double, std::greater<double> > eoAssembledMinimizingFitness; typedef eoScalarFitnessAssembled<double, std::greater<double>, eoScalarFitnessAssembledTraits > eoAssembledMinimizingFitness;
template <class F, class Cmp> template <class F, class Cmp, class FitnessTraits>
std::ostream& operator<<(std::ostream& os, const eoScalarFitnessAssembled<F, Cmp>& f) std::ostream& operator<<(std::ostream& os, const eoScalarFitnessAssembled<F, Cmp, FitnessTraits>& f)
{ {
for (unsigned i=0; i < f.size(); ++i) for (unsigned i=0; i < f.size(); ++i)
os << f[i] << " "; os << f[i] << " ";
return os; return os;
} }
template <class F, class Cmp> template <class F, class Cmp, class FitnessTraits>
std::istream& operator>>(std::istream& is, eoScalarFitnessAssembled<F, Cmp>& f) std::istream& operator>>(std::istream& is, eoScalarFitnessAssembled<F, Cmp, FitnessTraits>& f)
{ {
for (unsigned i=0; i < f.size(); ++i){ for (unsigned i=0; i < f.size(); ++i){
F value; F value;