Constructor revised
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1614 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
ff211f496c
commit
348da5c52c
3 changed files with 38 additions and 21 deletions
|
|
@ -76,7 +76,7 @@ public:
|
|||
* @param _max the max size for the pop
|
||||
*/
|
||||
moeoASEEA (unsigned int _maxGen, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoArchive < MOEOT > & _archive, unsigned int _max) :
|
||||
defaultGenContinuator(_maxGen), continuator(defaultGenContinuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), selectMany(_archive, _max), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(_crossover, _pCross, _mutation, _pMut), breed (selectTransform), archive(_archive)
|
||||
defaultGenContinuator(_maxGen), continuator(defaultGenContinuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), selectMany(_archive, _max), transform(_crossover, _pCross, _mutation, _pMut), selectTransform(selectMany, transform), breed (selectTransform), archive(_archive)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -84,11 +84,15 @@ public:
|
|||
* Ctor with a eoContinue.
|
||||
* @param _continuator stopping criteria
|
||||
* @param _eval evaluation function
|
||||
* @param _crossover crossover
|
||||
* @param _pCross crossover probability
|
||||
* @param _mutation mutation
|
||||
* @param _pMut mutation probability
|
||||
* @param _archive archive
|
||||
* @param _max the max size for the pop
|
||||
*/
|
||||
moeoASEEA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, moeoArchive < MOEOT > & _archive, unsigned int _max) :
|
||||
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), selectMany(_archive, _max), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), breed(selectTransform), archive(_archive)
|
||||
moeoASEEA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoArchive < MOEOT > & _archive, unsigned int _max) :
|
||||
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), selectMany(_archive, _max), transform(_crossover, _pCross, _mutation, _pMut), selectTransform(selectMany, transform), breed(selectTransform), archive(_archive)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -96,11 +100,15 @@ public:
|
|||
* Ctor with a eoContinue, a eoPopEval.
|
||||
* @param _continuator stopping criteria
|
||||
* @param _popEval population evaluation function
|
||||
* @param _crossover crossover
|
||||
* @param _pCross crossover probability
|
||||
* @param _mutation mutation
|
||||
* @param _pMut mutation probability
|
||||
* @param _archive archive
|
||||
* @param _max the max size for the pop
|
||||
*/
|
||||
moeoASEEA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, moeoArchive < MOEOT > & _archive, unsigned int _max) :
|
||||
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), selectMany(_archive, _max), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), breed(selectTransform), archive(_archive)
|
||||
moeoASEEA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoArchive < MOEOT > & _archive, unsigned int _max) :
|
||||
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), selectMany(_archive, _max), transform(_crossover, _pCross, _mutation, _pMut), selectTransform(selectMany, transform), breed(selectTransform), archive(_archive)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -113,7 +121,7 @@ public:
|
|||
* @param _max the max size for the pop
|
||||
*/
|
||||
moeoASEEA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoTransform < MOEOT > & _transform, moeoArchive < MOEOT > & _archive, unsigned int _max) :
|
||||
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), selectMany(_archive, _max), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), breed(selectTransform), archive(_archive)
|
||||
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), selectMany(_archive, _max), transform(defaultQuadOp, 0.0, defaultMonOp, 0.0), selectTransform(selectMany, _transform), breed(selectTransform), archive(_archive)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -126,7 +134,7 @@ public:
|
|||
* @param _max the max size for the pop
|
||||
*/
|
||||
moeoASEEA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoTransform < MOEOT > & _transform, moeoArchive < MOEOT > & _archive, unsigned int _max) :
|
||||
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), selectMany(_archive, _max), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), breed(selectTransform), archive(_archive)
|
||||
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), selectMany(_archive, _max), transform(defaultQuadOp, 0.0, defaultMonOp, 0.0), selectTransform(selectMany, _transform), breed(selectTransform), archive(_archive)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -159,12 +167,6 @@ protected:
|
|||
void operator()(MOEOT &) {}
|
||||
}defaultEval;
|
||||
|
||||
/** default select */
|
||||
class DummySelect : public eoSelect < MOEOT >{
|
||||
public :
|
||||
void operator()(const eoPop<MOEOT>&, eoPop<MOEOT>&) {}
|
||||
}defaultSelect;
|
||||
|
||||
/** default transform */
|
||||
class DummyTransform : public eoTransform < MOEOT >{
|
||||
public :
|
||||
|
|
@ -183,6 +185,8 @@ protected:
|
|||
eoPopEvalFunc < MOEOT > & popEval;
|
||||
/** default select many */
|
||||
moeoDetArchiveSelect < MOEOT > selectMany; // A REMPLACER !!!!!!!!!!! => add/moeoDetArchiveSelect.h
|
||||
/** eoTransform */
|
||||
eoSGATransform < MOEOT > transform;
|
||||
/** select transform */
|
||||
eoSelectTransform < MOEOT > selectTransform;
|
||||
/** a default crossover */
|
||||
|
|
@ -190,7 +194,9 @@ protected:
|
|||
/** a default mutation */
|
||||
eoMonCloneOp < MOEOT > defaultMonOp;
|
||||
/** an object for genetic operators (used as default) */
|
||||
eoSGAGenOp < MOEOT > defaultSGAGenOp;
|
||||
//eoSGAGenOp < MOEOT > defaultSGAGenOp;
|
||||
/** an object for genetic operators (used as default) */
|
||||
//eoSGAGenOp < MOEOT >& genOp;
|
||||
/** breeder */
|
||||
eoBreed < MOEOT > & breed;
|
||||
/**archive */
|
||||
|
|
|
|||
|
|
@ -57,15 +57,16 @@ class moeoDetArchiveSelect : public eoSelect<MOEOT>
|
|||
* @param _source compatibility parameter, not used
|
||||
* @param _dest destination population, selected from archive
|
||||
*/
|
||||
virtual void operator()(const eoPop < MOEOT > & _source, eoPop < MOEOT > & _dest)
|
||||
void operator()(const eoPop < MOEOT > & _source, eoPop < MOEOT > & _dest)
|
||||
{
|
||||
if(max < min){
|
||||
std::cout << "Warning! moeoDetArchiveSelect: min value > max value!!! Nothing is done." << std::endl;
|
||||
}
|
||||
else{
|
||||
|
||||
unsigned int archive_size = archive.size();
|
||||
_dest.resize(0);
|
||||
if (archive_size >= min && archive_size<= max){
|
||||
if ((archive_size >= min) && (archive_size <= max)){
|
||||
for (int i=0; i<archive_size; i++)
|
||||
_dest.push_back(archive[i]);
|
||||
}
|
||||
|
|
@ -79,8 +80,9 @@ class moeoDetArchiveSelect : public eoSelect<MOEOT>
|
|||
_dest.push_back(archive[permutation[i]]);
|
||||
}
|
||||
else {
|
||||
for (int i=0; i<min; i++)
|
||||
for (int i=0; i<min; i++){
|
||||
_dest.push_back(archive[i%archive_size]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue