/** -*- mode: c++; c-indent-level:
4; c++-member-init-indent: 8; comment-column: 35; -*-
The above line is usefulin Emacs-like editors */ /*
#ifndef _eoOneMax_h
|
/**
* A simple example class for bitstring (is NOT supposed to be used :-) */ |
template< class FitT>
class eoOneMax: public EO<FitT> { public: /** Deafult Ctor: nothing to be done */ eoOneMax() {} virtual string className() const
{ return "eoOneMax"; }
|
/** printing... */
void printOn(ostream& _os) const { // First write the fitness EO<FitT>::printOn(_os); _os << ' '; |
_os << b.size() << ' ' ;
for (unsigned i=0; i<b.size(); i++) _os << b[i] << ' ' ; |
}
/** reading...
|
unsigned s;
_is >> s; b.resize(s); for (unsigned i=0; i<s; i++) { bool bTmp; _is >> bTmp; b[i] = bTmp; } |
} |
// brute setting (we could
also have defined a Ctor from a vector<bool>)
void setB(vector<bool> & _b) { b=_b; } // brute accessing (we could
also define operator[] ...)
|
private: // put all data here |
std::vector<bool> b; |
};
#endif |