From 2184dc845fa316256226d880d4a18b82a23d7e3b Mon Sep 17 00:00:00 2001 From: okoenig Date: Mon, 16 Jun 2003 21:41:30 +0000 Subject: [PATCH] added a public bool feasible, used to identify feasible individuals in initialization processes --- eo/src/eoScalarFitnessAssembled.h | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/eo/src/eoScalarFitnessAssembled.h b/eo/src/eoScalarFitnessAssembled.h index 522dc973..fe734d76 100644 --- a/eo/src/eoScalarFitnessAssembled.h +++ b/eo/src/eoScalarFitnessAssembled.h @@ -93,26 +93,37 @@ public: // Basic constructors and assignments eoScalarFitnessAssembled() - : baseVector( FitnessTraits::size() ) {} + : baseVector( FitnessTraits::size() ), + feasible(true) + {} eoScalarFitnessAssembled( size_type _n, const ScalarType& _val, const std::string& _descr="Unnamed variable" ) - : baseVector(_n, _val) + : baseVector(_n, _val), + feasible(true) { if ( _n > FitnessTraits::size() ) FitnessTraits::resize(_n, _descr); } - eoScalarFitnessAssembled( const eoScalarFitnessAssembled& other) : baseVector( other ) {} + eoScalarFitnessAssembled( const eoScalarFitnessAssembled& other) + : baseVector( other ), + feasible(other.feasible) + {} eoScalarFitnessAssembled& operator=( const eoScalarFitnessAssembled& other) { baseVector::operator=( other ); + feasible = other.feasible; return *this; } // Constructors and assignments to work with scalar type - eoScalarFitnessAssembled( const ScalarType& v ) : baseVector( 1, v ) {} + eoScalarFitnessAssembled( const ScalarType& v ) + : baseVector( 1, v ), + feasible(true) + {} + eoScalarFitnessAssembled& operator=( const ScalarType& v ) { if ( empty() ) @@ -120,6 +131,8 @@ public: else front() = v; + feasible=true; + return *this; } @@ -152,6 +165,13 @@ public: //! Get vector with descriptions std::vector getDescriptionVector() { return FitnessTraits::getDescriptionVector(); } + + //! Feasibility boolean + /** + * Can be specified anywhere in fitness evaluation + * as an indicator if the individual is in some feasible range. + */ + bool feasible; // Scalar type access operator ScalarType(void) const {