Initialize booleans to get rid of compiler-warnings.

This commit is contained in:
kuepper 2005-10-03 09:47:06 +00:00
commit 03b1689de9
2 changed files with 65 additions and 65 deletions

View file

@ -25,43 +25,43 @@ template<class GenotypeT>
class eoOneMaxMutation: public eoMonOp<GenotypeT> class eoOneMaxMutation: public eoMonOp<GenotypeT>
{ {
public: public:
/** /**
* Ctor - no requirement * Ctor - no requirement
*/ */
// START eventually add or modify the anyVariable argument // START eventually add or modify the anyVariable argument
eoOneMaxMutation() eoOneMaxMutation()
// eoOneMaxMutation( varType _anyVariable) : anyVariable(_anyVariable) // eoOneMaxMutation( varType _anyVariable) : anyVariable(_anyVariable)
// END eventually add or modify the anyVariable argument // END eventually add or modify the anyVariable argument
{ {
// START Code of Ctor of an eoOneMaxEvalFunc object // START Code of Ctor of an eoOneMaxEvalFunc object
// END Code of Ctor of an eoOneMaxEvalFunc object // END Code of Ctor of an eoOneMaxEvalFunc object
} }
/// The class name. Used to display statistics /// The class name. Used to display statistics
string className() const { return "eoOneMaxMutation"; } string className() const { return "eoOneMaxMutation"; }
/** /**
* modifies the parent * modifies the parent
* @param _genotype The parent genotype (will be modified) * @param _genotype The parent genotype (will be modified)
*/ */
bool operator()(GenotypeT & _genotype) bool operator()(GenotypeT & _genotype)
{ {
bool isModified; bool isModified(true);
// START code for mutation of the _genotype object // START code for mutation of the _genotype object
/** Requirement /** Requirement
* if (_genotype has been modified) * if (_genotype has been modified)
* isModified = true; * isModified = true;
* else * else
* isModified = false; * isModified = false;
*/ */
return isModified; return isModified;
// END code for mutation of the _genotype object // END code for mutation of the _genotype object
} }
private: private:
// START Private data of an eoOneMaxMutation object // START Private data of an eoOneMaxMutation object
// varType anyVariable; // for example ... // varType anyVariable; // for example ...
// END Private data of an eoOneMaxMutation object // END Private data of an eoOneMaxMutation object
}; };

View file

@ -1,7 +1,7 @@
/** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- /** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
The above line is usefulin Emacs-like editors The above line is usefulin Emacs-like editors
*/ */
/* /*
Template for simple quadratic crossover operators Template for simple quadratic crossover operators
@ -15,55 +15,55 @@ Quadratic crossover operators modify the both genotypes
#include <eoOp.h> #include <eoOp.h>
/** /**
* Always write a comment in this format before class definition * Always write a comment in this format before class definition
* if you want the class to be documented by Doxygen * if you want the class to be documented by Doxygen
* *
* THere is NO ASSUMPTION on the class GenoypeT. * THere is NO ASSUMPTION on the class GenoypeT.
* In particular, it does not need to derive from EO * In particular, it does not need to derive from EO
*/ */
template<class GenotypeT> template<class GenotypeT>
class eoOneMaxQuadCrossover: public eoQuadOp<GenotypeT> class eoOneMaxQuadCrossover: public eoQuadOp<GenotypeT>
{ {
public: public:
/** /**
* Ctor - no requirement * Ctor - no requirement
*/ */
// START eventually add or modify the anyVariable argument // START eventually add or modify the anyVariable argument
eoOneMaxQuadCrossover() eoOneMaxQuadCrossover()
// eoOneMaxQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable) // eoOneMaxQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable)
// END eventually add or modify the anyVariable argument // END eventually add or modify the anyVariable argument
{ {
// START Code of Ctor of an eoOneMaxEvalFunc object // START Code of Ctor of an eoOneMaxEvalFunc object
// END Code of Ctor of an eoOneMaxEvalFunc object // END Code of Ctor of an eoOneMaxEvalFunc object
} }
/// The class name. Used to display statistics /// The class name. Used to display statistics
string className() const { return "eoOneMaxQuadCrossover"; } string className() const { return "eoOneMaxQuadCrossover"; }
/** /**
* eoQuad crossover - modifies both parents * eoQuad crossover - modifies both parents
* @param _genotype1 The first parent * @param _genotype1 The first parent
* @param _genotype2 The second parent * @param _genotype2 The second parent
*/ */
bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2) bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2)
{ {
bool oneAtLeastIsModified; bool oneAtLeastIsModified(true);
// START code for crossover of _genotype1 and _genotype2 objects // START code for crossover of _genotype1 and _genotype2 objects
/** Requirement /** Requirement
* if (at least one genotype has been modified) // no way to distinguish * if (at least one genotype has been modified) // no way to distinguish
* oneAtLeastIsModified = true; * oneAtLeastIsModified = true;
* else * else
* oneAtLeastIsModified = false; * oneAtLeastIsModified = false;
*/ */
return oneAtLeastIsModified; return oneAtLeastIsModified;
// END code for crossover of _genotype1 and _genotype2 objects // END code for crossover of _genotype1 and _genotype2 objects
} }
private: private:
// START Private data of an eoOneMaxQuadCrossover object // START Private data of an eoOneMaxQuadCrossover object
// varType anyVariable; // for example ... // varType anyVariable; // for example ...
// END Private data of an eoOneMaxQuadCrossover object // END Private data of an eoOneMaxQuadCrossover object
}; };