Added a failed boolean to indicate if fitness evaluation succeeded ( useful if programs are involved, where fitness evaluation can fail for some indis)

This commit is contained in:
okoenig 2004-06-14 11:23:48 +00:00
commit 06eb601d8e

View file

@ -94,14 +94,14 @@ public:
// Basic constructors and assignments // Basic constructors and assignments
eoScalarFitnessAssembled() eoScalarFitnessAssembled()
: baseVector( FitnessTraits::size() ), : baseVector( FitnessTraits::size() ),
feasible(true) feasible(true), failed(false)
{} {}
eoScalarFitnessAssembled( size_type _n, eoScalarFitnessAssembled( size_type _n,
const ScalarType& _val, const ScalarType& _val,
const std::string& _descr="Unnamed variable" ) const std::string& _descr="Unnamed variable" )
: baseVector(_n, _val), : baseVector(_n, _val),
feasible(true) feasible(true), failed(false)
{ {
if ( _n > FitnessTraits::size() ) if ( _n > FitnessTraits::size() )
FitnessTraits::resize(_n, _descr); FitnessTraits::resize(_n, _descr);
@ -109,19 +109,21 @@ public:
eoScalarFitnessAssembled( const eoScalarFitnessAssembled& other) eoScalarFitnessAssembled( const eoScalarFitnessAssembled& other)
: baseVector( other ), : baseVector( other ),
feasible(other.feasible) feasible(other.feasible),
failed(other.failed)
{} {}
eoScalarFitnessAssembled& operator=( const eoScalarFitnessAssembled& other) { eoScalarFitnessAssembled& operator=( const eoScalarFitnessAssembled& other) {
baseVector::operator=( other ); baseVector::operator=( other );
feasible = other.feasible; feasible = other.feasible;
failed = other.failed;
return *this; return *this;
} }
// Constructors and assignments to work with scalar type // Constructors and assignments to work with scalar type
eoScalarFitnessAssembled( const ScalarType& v ) eoScalarFitnessAssembled( const ScalarType& v )
: baseVector( 1, v ), : baseVector( 1, v ),
feasible(true) feasible(true), failed(false)
{} {}
eoScalarFitnessAssembled& operator=( const ScalarType& v ) { eoScalarFitnessAssembled& operator=( const ScalarType& v ) {
@ -171,6 +173,14 @@ public:
*/ */
bool feasible; bool feasible;
//! Failed boolean
/**
* Can be specified anywhere in fitness evaluation
* as an indicator if the evaluation of the individual failed
*/
bool failed;
// Scalar type access // Scalar type access
operator ScalarType(void) const { operator ScalarType(void) const {
if ( empty() ) if ( empty() )