Merge branch 'mo-1.3' of git:do into mo-1.3

This commit is contained in:
Caner Candan 2010-09-09 13:55:59 +02:00
commit 6a613bc4a1

35
src/doBounderUniform.h Normal file
View file

@ -0,0 +1,35 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
*/
#ifndef _doBounderUniform_h
#define _doBounderUniform_h
#include "doBounder.h"
template < typename EOT >
class doBounderUniform : public doBounder< EOT >
{
public:
doBounderUniform( EOT min, EOT max )
: doBounder< EOT >( min, max )
{}
void operator()( EOT& sol )
{
unsigned int size = sol.size();
assert(size > 0);
for (unsigned int d = 0; d < size; ++d) {
if ( sol[d] < this->min()[d] || sol[d] > this->max()[d]) {
// use EO's global "rng"
sol[d] = rng.uniform( this->min()[d], this->max()[d] );
}
} // for d in size
}
};
#endif // !_doBounderUniform_h