This repository has been archived on 2026-03-28. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
eodev/src/doBounderUniform.h

35 lines
770 B
C++

// (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