Modified eoInit so that it would use the eoRndGenerator base class.
To be able to use the primitive std::generate function, added a set of wrappers in eoSTLFunctor.h that have the copy semantics most STL functions expect (namely pass-by-value rather then pass-by-reference). Updated test/Makefile.am to also test t-eoRandom
This commit is contained in:
parent
e28211188a
commit
a79075f673
11 changed files with 240 additions and 83 deletions
|
|
@ -62,13 +62,13 @@ template <class FitT> class eoBit: public eoVector<FitT, bool>
|
|||
*/
|
||||
eoBit(unsigned size = 0, bool value = false):
|
||||
eoVector<FitT, bool>(size, value) {}
|
||||
|
||||
|
||||
/// My class name.
|
||||
string className() const
|
||||
{
|
||||
return "eoBit";
|
||||
string className() const
|
||||
{
|
||||
return "eoBit";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To print me on a stream.
|
||||
* @param os The ostream.
|
||||
|
|
@ -77,10 +77,10 @@ template <class FitT> class eoBit: public eoVector<FitT, bool>
|
|||
{
|
||||
EO<FitT>::printOn(os);
|
||||
os << ' ';
|
||||
os << size() << ' ';
|
||||
os << size() << ' ';
|
||||
copy(begin(), end(), ostream_iterator<bool>(os));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To read me from a stream.
|
||||
* @param is The istream.
|
||||
|
|
@ -95,7 +95,7 @@ template <class FitT> class eoBit: public eoVector<FitT, bool>
|
|||
if (is)
|
||||
{
|
||||
resize(bits.size());
|
||||
transform(bits.begin(), bits.end(), begin(),
|
||||
transform(bits.begin(), bits.end(), begin(),
|
||||
bind2nd(equal_to<char>(), '1'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ eoPop<eoBit<FitT> >& do_init_ga(eoParameterLoader& _parser, eoState& _state, Fi
|
|||
_parser.processParam(chromSize, "initialization");
|
||||
_parser.processParam(popSize, "initialization");
|
||||
|
||||
eoInitFixedLength<EOT, boolean_generator> init(chromSize.value(), boolean_generator());
|
||||
|
||||
eoBooleanGenerator gen;
|
||||
eoInitFixedLength<EOT> init(chromSize.value(), gen);
|
||||
|
||||
// Let the state handle the memory
|
||||
eoPop<EOT>& pop = _state.takeOwnership(eoPop<EOT>());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue