Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Beagle::DecimateOp Class Reference
[Generic EC FrameworkOperators and Evolvers]

Population decimation operator class.

This operator shrinks the population size (i.e. it "decimates" the population). The decimation is done by keeping the n best individuals of the population, where n is $ratio \times population size$ and ratio is the decimation ratio, which is less than or equal to 1.0. More...

#include <beagle/DecimateOp.hpp>

Inheritance diagram for Beagle::DecimateOp:

Beagle::Operator Beagle::NamedObject Beagle::Object List of all members.

Public Types

typedef AllocatorT< DecimateOp,
Operator::Alloc
Alloc
 DecimateOp allocator type.
typedef PointerT< DecimateOp,
Operator::Handle
Handle
 DecimateOp handle type.
typedef ContainerT< DecimateOp,
Operator::Bag
Bag
 DecimateOp bag type.

Public Member Functions

 DecimateOp (string inDecimationRatioName="ec.decimation.ratio", string inName="DecimateOp")
 Construct a plain new decimation operator.
virtual ~DecimateOp ()
virtual void initialize (System &ioSystem)
 Initialize the decimation operator.
virtual void operate (Deme &ioDeme, Context &ioContext)
 Apply the decimation operation on the deme.
virtual PointerT< Operator,
NamedObject::Handle
giveReference ()
 Give a reference to the current operator.
virtual void readWithMap (PACC::XML::ConstIterator inIter, OperatorMap &inOpMap)
 Read an operator from a XML subtree.
virtual void write (PACC::XML::Streamer &ioStreamer, bool inIndent=true) const
 Write an operator into an XML stream.
bool isInitialized () const
bool isPostInitialized () const
virtual void postInit (System &ioSystem)
 Post-initialization operator hook.
void setInitialized (bool inInitialized=true)
 Set the operator initialization state.
void setPostInitialized (bool inPostInitialized=true)
 Set the operator initialization state.
virtual void read (PACC::XML::ConstIterator inIter)
 Reading a operator with method read is undefined. Use readWithMap instead.
virtual const stringgetName () const
 Returns the name of the object.
virtual void setName (const string &inName)
 Sets the name of the object.
virtual bool isEqual (const Object &inRightObj) const
 Test if an object is equal to another.
virtual bool isLess (const Object &inRightObj) const
 Test if an object is less than another.
virtual string serialize (bool inIndent=false, unsigned int inIndentWidth=0) const
 Transform an Object into a linear string (using write method).
unsigned int getRefCounter () const
 Gives the number of smart pointers that refer to the actual object.
Objectrefer ()
 Increments the reference counter and returns a pointer to the actual object.
void unrefer ()
 Decrement the reference counter and deletes the actual object if it reaches zero.

Protected Attributes

UIntArray::Handle mPopSize
 Population size for the evolution.
Float::Handle mDecimationRatio
 Decimation ratio for the actual population.
string mDecimationRatioName
 Decimation ratio parameter name.

Related Functions

(Note that these are not member functions.)

template<class CastPointerType>
CastPointerType castObjectT (Beagle::Object *inObject)
 Cast a Beagle::Object pointer into a CastType pointer.
template<class CastPointerType>
CastPointerType castObjectT (const Beagle::Object *inObject)
 Cast a Beagle::Object constant pointer into a CastType constant pointer.
template<class CastRefType>
CastRefType castObjectT (Beagle::Object &inObject)
 Cast a Beagle::Object reference into a CastType reference.
template<class CastConstRefType>
CastConstRefType castObjectT (const Beagle::Object &inObject)
 Cast a Beagle::Object constant reference into a CastType constant reference.
template<class CastType>
CastType::Handle & castHandleT (Beagle::Object::Handle &inObject)
 Cast a Beagle::Object smart pointer into a CastType handle type.
template<class CastType>
const CastType::Handle & castHandleT (const Beagle::Object::Handle &inObject)
 Cast a constant Beagle::Object smart pointer into a constant CastType handle type.
bool operator< (const Beagle::Object &inLeftObj, const Beagle::Object &inRightObj)
 Test whether an object is less than another.
bool operator<= (const Beagle::Object &inLeftObj, const Beagle::Object &inRightObj)
 Test whether an object is less than, or equal to another.
bool operator> (const Beagle::Object &inLeftObj, const Beagle::Object &inRightObj)
 Test whether an object is more than another.
bool operator>= (const Beagle::Object &inLeftObj, const Beagle::Object &inRightObj)
 Test whether an object is more than, or equal to another.
bool operator== (const Beagle::Object &inLeftObj, const Beagle::Object &inRightObj)
 Test whether an object is equal to another.
bool operator!= (const Beagle::Object &inLeftObj, const Beagle::Object &inRightObj)
 Test whether an object is not equal to another.

Detailed Description

Population decimation operator class.

This operator shrinks the population size (i.e. it "decimates" the population). The decimation is done by keeping the n best individuals of the population, where n is $ratio \times population size$ and ratio is the decimation ratio, which is less than or equal to 1.0.

The name of the decimation ratio defaults to "ec.decimation.ratio".

A special decimation ratio exists: -1.0. If this ratio is used then the population will be reduced to the size specified in the register variable "ec.pop.size". If the use of this special ratio would result in an increase in the population size then an exception is thrown.

To increase the size of the population, consider Beagle::OversizeOp.

Definition at line 81 of file DecimateOp.hpp.


Member Typedef Documentation

typedef AllocatorT<DecimateOp,Operator::Alloc> Beagle::DecimateOp::Alloc
 

DecimateOp allocator type.

Reimplemented from Beagle::Operator.

Definition at line 87 of file DecimateOp.hpp.

typedef ContainerT<DecimateOp,Operator::Bag> Beagle::DecimateOp::Bag
 

DecimateOp bag type.

Reimplemented from Beagle::Operator.

Definition at line 93 of file DecimateOp.hpp.

typedef PointerT<DecimateOp,Operator::Handle> Beagle::DecimateOp::Handle
 

DecimateOp handle type.

Reimplemented from Beagle::Operator.

Definition at line 90 of file DecimateOp.hpp.


Constructor & Destructor Documentation

DecimateOp::DecimateOp Beagle::string  inDecimationRatioName = "ec.decimation.ratio",
Beagle::string  inName = "DecimateOp"
[explicit]
 

Construct a plain new decimation operator.

Parameters:
inDecimationRatioName Decimation ratio parameter name.
inName Name of the decimation operator.

Definition at line 49 of file DecimateOp.cpp.

virtual Beagle::DecimateOp::~DecimateOp  )  [inline, virtual]
 

Definition at line 97 of file DecimateOp.hpp.


Member Function Documentation

const Beagle::string & NamedObject::getName  )  const [virtual, inherited]
 

Returns the name of the object.

Reimplemented from Beagle::Object.

Definition at line 53 of file NamedObject.cpp.

References Beagle_StackTraceBeginM, and Beagle_StackTraceEndM.

Referenced by Beagle::EvaluationMultipleOp::breed(), Beagle::ReplacementStrategyOp::buildRoulette(), Beagle::GP::Invoker::execute(), Beagle::GP::Argument::generateArgument(), Beagle::GP::ArgumentT< T >::generateArgument(), Beagle::GP::Module::getCandidatesToInvoke(), Beagle::GP::Primitive::getValue(), Beagle::GP::Invoker::giveReference(), Beagle::GP::EphemeralT< T >::giveReference(), Beagle::GP::Primitive::isEqual(), Beagle::LoggerXML::LoggerXML(), Beagle::TerminationOp::operate(), Beagle::InitializationOp::operate(), Beagle::LoggerXML::operator=(), Beagle::Operator::read(), Beagle::GP::EphemeralT< T >::read(), Beagle::GP::Primitive::readWithContext(), Beagle::TermMinFitnessOp::readWithMap(), Beagle::TermMaxFitnessOp::readWithMap(), Beagle::SelectionOp::readWithMap(), Beagle::ReplacementStrategyOp::readWithMap(), Beagle::OversizeOp::readWithMap(), Beagle::Operator::readWithMap(), Beagle::NSGA2Op::readWithMap(), Beagle::MutationOp::readWithMap(), Beagle::MuPlusLambdaOp::readWithMap(), Beagle::MuCommaLambdaOp::readWithMap(), Beagle::InitializationOp::readWithMap(), Beagle::IfThenElseOp::readWithMap(), Beagle::GP::CrossoverOp::readWithMap(), Beagle::CrossoverOp::readWithMap(), Beagle::GP::TermMaxHitsOp::readWithMap(), Beagle::GP::MutationSwapSubtreeOp::readWithMap(), Beagle::GP::MutationSwapOp::readWithMap(), Beagle::GP::MutationStandardOp::readWithMap(), Beagle::GP::MutationEphemeralOpT< T >::readWithMap(), Beagle::GA::MutationUniformIntVecOp::readWithMap(), Beagle::GA::MutationShuffleIntVecOp::readWithMap(), Beagle::GA::MutationGaussianFltVecOp::readWithMap(), Beagle::GA::MutationFlipBitStrOp::readWithMap(), Beagle::GA::MutationESVecOp::readWithMap(), Beagle::GA::CrossoverUniformOpT< T >::readWithMap(), Beagle::Component::readWithSystem(), Beagle::GP::Primitive::setValue(), Beagle::GP::Primitive::validate(), Beagle::GP::Module::validate(), Beagle::TermMinFitnessOp::write(), Beagle::TermMaxFitnessOp::write(), Beagle::ReplacementStrategyOp::write(), Beagle::OversizeOp::write(), Beagle::Operator::write(), Beagle::NSGA2Op::write(), Beagle::MuPlusLambdaOp::write(), Beagle::MuCommaLambdaOp::write(), Beagle::IfThenElseOp::write(), Beagle::Component::write(), Beagle::BreederOp::write(), Beagle::GP::TermMaxHitsOp::write(), and Beagle::GP::Primitive::write().

unsigned int Beagle::Object::getRefCounter  )  const [inline, inherited]
 

Gives the number of smart pointers that refer to the actual object.

Returns:
Value of the reference counter.

Definition at line 185 of file Object.hpp.

Referenced by Beagle::ObjectException::setObjectState().

PointerT< Operator, NamedObject::Handle > Operator::giveReference  )  [virtual, inherited]
 

Give a reference to the current operator.

Returns:
Handle to the refered operator.

Reimplemented in Beagle::IfThenElseOp.

Definition at line 58 of file Operator.cpp.

References Beagle_StackTraceBeginM, and Beagle_StackTraceEndM.

void DecimateOp::initialize System ioSystem  )  [virtual]
 

Initialize the decimation operator.

Parameters:
ioSystem Reference to the system to use for decimation.

Reimplemented from Beagle::Operator.

Definition at line 59 of file DecimateOp.cpp.

References Beagle::Register::addEntry(), Beagle_StackTraceBeginM, Beagle_StackTraceEndM, Beagle::Register::getEntry(), Beagle::System::getRegister(), Beagle::Operator::initialize(), Beagle::Register::isRegistered(), mDecimationRatio, mDecimationRatioName, and mPopSize.

bool Object::isEqual const Object inRightObj  )  const [virtual, inherited]
 

Test if an object is equal to another.

Parameters:
inRightObj Object to be compare to.
Returns:
True if actual object is equal to right object, false if not.
Exceptions:
Beagle::InternalException If the method is not overdefined in a subclass.

Reimplemented in Beagle::ArrayT< T >, Beagle::Container, Beagle::FitnessMultiObj, Beagle::FitnessSimple, Beagle::Map, Beagle::WrapperT< T >, Beagle::GA::BitString, Beagle::GA::ESVector, Beagle::GA::FloatVector, Beagle::GA::IntegerVector, Beagle::GP::Primitive, and Beagle::GP::Tree.

Definition at line 111 of file Object.cpp.

References Beagle_StackTraceBeginM, Beagle_StackTraceEndM, Beagle_UndefinedMethodInternalExceptionM, and Beagle::Object::getName().

Referenced by Beagle::Object::operator!=(), Beagle::Object::operator<=(), Beagle::Object::operator==(), and Beagle::Object::operator>=().

bool Beagle::Operator::isInitialized  )  const [inline, inherited]
 

Returns:
Whether the operator has been initialized or not.

Definition at line 167 of file Operator.hpp.

References Beagle_StackTraceBeginM, and Beagle_StackTraceEndM.

bool Object::isLess const Object inRightObj  )  const [virtual, inherited]
 

Test if an object is less than another.

Parameters:
inRightObj Object to be compare to.
Returns:
True if actual object is less than right object, false if not.
Exceptions:
Beagle::InternalException If the method is not overdefined in a subclass.

Reimplemented in Beagle::ArrayT< T >, Beagle::Container, Beagle::FitnessMultiObj, Beagle::FitnessMultiObjMin, Beagle::FitnessSimple, Beagle::FitnessSimpleMin, Beagle::Map, Beagle::WrapperT< T >, Beagle::GA::BitString, Beagle::GA::FloatVector, and Beagle::GA::IntegerVector.

Definition at line 125 of file Object.cpp.

References Beagle_StackTraceBeginM, Beagle_StackTraceEndM, Beagle_UndefinedMethodInternalExceptionM, and Beagle::Object::getName().

Referenced by Beagle::Object::operator<(), Beagle::Object::operator<=(), Beagle::Object::operator>(), and Beagle::Object::operator>=().

bool Beagle::Operator::isPostInitialized  )  const [inline, inherited]
 

Returns:
Whether the operator has been post-initialized or not.

Definition at line 177 of file Operator.hpp.

References Beagle_StackTraceBeginM, and Beagle_StackTraceEndM.

void DecimateOp::operate Deme ioDeme,
Context ioContext
[virtual]
 

Apply the decimation operation on the deme.

Parameters:
ioDeme Current deme of individuals to decimate.
ioContext Context of the evolution.

Implements Beagle::Operator.

Definition at line 106 of file DecimateOp.cpp.

References Beagle_AssertM, Beagle_LogTraceM, Beagle_StackTraceBeginM, Beagle_StackTraceEndM, Beagle_ValidateParameterM, Beagle::Context::getDemeIndex(), Beagle::System::getLogger(), Beagle::Context::getSystem(), mDecimationRatio, mDecimationRatioName, mPopSize, Beagle::ContainerT< T, BaseType >::resize(), and Beagle::uint2ordinal().

virtual void Beagle::Operator::postInit System ioSystem  )  [inline, virtual, inherited]
 

Post-initialization operator hook.

Parameters:
ioSystem Reference to the evolutionary system.

Reimplemented in Beagle::IfThenElseOp, Beagle::NPGA2Op, Beagle::NSGA2Op, Beagle::ReplacementStrategyOp, Beagle::GA::MuWCommaLambdaCMAFltVecOp, Beagle::GP::MutationStandardOp, KnapsackEvalOp, TSPEvalOp, SymbRegEvalOp, and SpambaseEvalOp.

Definition at line 188 of file Operator.hpp.

Referenced by SymbRegEvalOp::postInit(), SpambaseEvalOp::postInit(), TSPEvalOp::postInit(), and KnapsackEvalOp::postInit().

void Operator::read PACC::XML::ConstIterator  inIter  )  [virtual, inherited]
 

Reading a operator with method read is undefined. Use readWithMap instead.

Reimplemented from Beagle::Object.

Definition at line 69 of file Operator.cpp.

References Beagle_StackTraceBeginM, Beagle_StackTraceEndM, Beagle_UndefinedMethodInternalExceptionM, and Beagle::NamedObject::getName().

void Operator::readWithMap PACC::XML::ConstIterator  inIter,
OperatorMap inOpMap
[virtual, inherited]
 

Read an operator from a XML subtree.

Parameters:
inIter XML iterator from which the operator is read.
inOpMap Operator map to use to read operator.
Exceptions:
IOException If a reading error occurs.

Reimplemented in Beagle::CrossoverOp, Beagle::IfThenElseOp, Beagle::InitializationOp, Beagle::MuCommaLambdaOp, Beagle::MuPlusLambdaOp, Beagle::MutationOp, Beagle::NSGA2Op, Beagle::OversizeOp, Beagle::ReplacementStrategyOp, Beagle::SelectionOp, Beagle::TermMaxFitnessOp, Beagle::TermMinFitnessOp, Beagle::GA::CrossoverUniformOpT< T >, Beagle::GA::MutationESVecOp, Beagle::GA::MutationFlipBitStrOp, Beagle::GA::MutationGaussianFltVecOp, Beagle::GA::MutationShuffleIntVecOp, Beagle::GA::MutationUniformIntVecOp, Beagle::GP::CrossoverOp, Beagle::GP::MutationEphemeralOpT< T >, Beagle::GP::MutationStandardOp, Beagle::GP::MutationSwapOp, Beagle::GP::MutationSwapSubtreeOp, Beagle::GP::TermMaxHitsOp, Beagle::GA::CrossoverUniformOpT< GA::FloatVector >, Beagle::GA::CrossoverUniformOpT< GA::BitString >, Beagle::GA::CrossoverUniformOpT< GA::IntegerVector >, Beagle::GA::CrossoverUniformOpT< GA::ESVector >, and Beagle::GP::MutationEphemeralOpT< Double >.

Definition at line 83 of file Operator.cpp.

References Beagle_IOExceptionNodeM, Beagle_StackTraceBeginM, Beagle_StackTraceEndM, PACC::XML::eData, and Beagle::NamedObject::getName().

Object* Beagle::Object::refer  )  [inline, inherited]
 

Increments the reference counter and returns a pointer to the actual object.

Returns:
Pointer to the actual object.

Definition at line 194 of file Object.hpp.

Referenced by Beagle::Pointer::operator=().

Beagle::string Object::serialize bool  inIndent = false,
unsigned int  inIndentWidth = 0
const [virtual, inherited]
 

Transform an Object into a linear string (using write method).

Parameters:
inIndent Whether serialized output should be indented.
inIndentWidth Number of spaces for each indent. Supplying a value of zero will produce the data without indentation and without any newlines.
Returns:
String representing the Object.

Definition at line 153 of file Object.cpp.

References Beagle_StackTraceBeginM, Beagle_StackTraceEndM, and Beagle::Object::write().

Referenced by Beagle::GP::ModuleCompressOp::compress(), Beagle::GP::ModuleExpandOp::expand(), Beagle::GP::Primitive::get1stArgument(), Beagle::GP::Tree::interpret(), Beagle::Logger::logObject(), Beagle::Register::readWithSystem(), Beagle::GP::Individual::run(), Beagle::ObjectException::setObjectState(), Beagle::GP::EvaluationOp::setValue(), and Beagle::Coev::GPEvaluationOp::setValue().

void Beagle::Operator::setInitialized bool  inInitialized = true  )  [inline, inherited]
 

Set the operator initialization state.

Parameters:
inInitialized Initialization state

Definition at line 194 of file Operator.hpp.

References Beagle_StackTraceBeginM, and Beagle_StackTraceEndM.

void NamedObject::setName const string inName  )  [virtual, inherited]
 

Sets the name of the object.

Parameters:
inName Name of the object

Definition at line 65 of file NamedObject.cpp.

References Beagle_StackTraceBeginM, and Beagle_StackTraceEndM.

void Beagle::Operator::setPostInitialized bool  inPostInitialized = true  )  [inline, inherited]
 

Set the operator initialization state.

Parameters:
inPostInitialized Initialization state

Definition at line 205 of file Operator.hpp.

References Beagle_StackTraceBeginM, and Beagle_StackTraceEndM.

void Beagle::Object::unrefer  )  [inline, inherited]
 

Decrement the reference counter and deletes the actual object if it reaches zero.

Definition at line 203 of file Object.hpp.

Referenced by Beagle::Pointer::operator=(), and Beagle::Pointer::~Pointer().

void Operator::write PACC::XML::Streamer ioStreamer,
bool  inIndent = true
const [virtual, inherited]
 

Write an operator into an XML stream.

Parameters:
ioStreamer XML stream in which the operator is written.
inIndent Whether XML output should be indented.

Reimplemented from Beagle::Object.

Reimplemented in Beagle::BreederOp, Beagle::IfThenElseOp, Beagle::MuCommaLambdaOp, Beagle::MuPlusLambdaOp, Beagle::NSGA2Op, Beagle::OversizeOp, Beagle::ReplacementStrategyOp, Beagle::TermMaxFitnessOp, Beagle::TermMinFitnessOp, and Beagle::GP::TermMaxHitsOp.

Definition at line 100 of file Operator.cpp.

References Beagle_StackTraceBeginM, Beagle_StackTraceEndM, PACC::XML::Streamer::closeTag(), Beagle::NamedObject::getName(), and PACC::XML::Streamer::openTag().


Friends And Related Function Documentation

bool operator!= const Beagle::Object inLeftObj,
const Beagle::Object inRightObj
[related, inherited]
 

Test whether an object is not equal to another.

Parameters:
inLeftObj Left object compared.
inRightObj Right object compared.
Returns:
True if left object is not equal to the right one, false if it is.
Note:
The operator is defined relatively to the function isEqual of Beagle::Object.

Definition at line 301 of file Object.hpp.

References Beagle::Object::isEqual().

bool operator< const Beagle::Object inLeftObj,
const Beagle::Object inRightObj
[related, inherited]
 

Test whether an object is less than another.

Parameters:
inLeftObj Left object compared.
inRightObj Right object compared.
Returns:
True if left object is less than the right one, false if not.
Note:
The operator is defined relatively to the function isLess of Beagle::Object.

Definition at line 226 of file Object.hpp.

References Beagle::Object::isLess().

bool operator<= const Beagle::Object inLeftObj,
const Beagle::Object inRightObj
[related, inherited]
 

Test whether an object is less than, or equal to another.

Parameters:
inLeftObj Left object compared.
inRightObj Right object compared.
Returns:
True if left object is less than, or equal to the right one, false if not.
Note:
The operator is defined relatively to the functions isLess and isEqual of Beagle::Object.

Definition at line 241 of file Object.hpp.

References Beagle::Object::isEqual(), and Beagle::Object::isLess().

bool operator== const Beagle::Object inLeftObj,
const Beagle::Object inRightObj
[related, inherited]
 

Test whether an object is equal to another.

Parameters:
inLeftObj Left object compared.
inRightObj Right object compared.
Returns:
True if left object is equal to the right one, false if not.
Note:
The operator is defined relatively to the function isEqual of Beagle::Object.

Definition at line 286 of file Object.hpp.

References Beagle::Object::isEqual().

bool operator> const Beagle::Object inLeftObj,
const Beagle::Object inRightObj
[related, inherited]
 

Test whether an object is more than another.

Parameters:
inLeftObj Left object compared.
inRightObj Right object compared.
Returns:
True if left object is more than the right one, false if not.
Note:
The operator is defined relatively to the function isLess of Beagle::Object.

Definition at line 256 of file Object.hpp.

References Beagle::Object::isLess().

bool operator>= const Beagle::Object inLeftObj,
const Beagle::Object inRightObj
[related, inherited]
 

Test whether an object is more than, or equal to another.

Parameters:
inLeftObj Left object compared.
inRightObj Right object compared.
Returns:
True if left object is more than, or equal to the right one, false if not.
Note:
The operator is defined relatively to the functions isLess and isEqual of Beagle::Object.

Definition at line 271 of file Object.hpp.

References Beagle::Object::isEqual(), and Beagle::Object::isLess().


Member Data Documentation

Float::Handle Beagle::DecimateOp::mDecimationRatio [protected]
 

Decimation ratio for the actual population.

Definition at line 104 of file DecimateOp.hpp.

Referenced by initialize(), and operate().

string Beagle::DecimateOp::mDecimationRatioName [protected]
 

Decimation ratio parameter name.

Definition at line 105 of file DecimateOp.hpp.

Referenced by initialize(), and operate().

UIntArray::Handle Beagle::DecimateOp::mPopSize [protected]
 

Population size for the evolution.

Definition at line 103 of file DecimateOp.hpp.

Referenced by initialize(), and operate().


The documentation for this class was generated from the following files:
Generated on Wed Oct 5 17:03:09 2005 for Open BEAGLE by  doxygen 1.4.4