Delete peoPopEval

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@843 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
canape 2007-12-13 14:04:20 +00:00
commit 0e34aae83f
9 changed files with 7 additions and 296 deletions

View file

@ -327,9 +327,7 @@
#include "peoWrapper.h"
/* <------- components for parallel algorithms -------> */
#include "peoSeqTransform.h"
#include "peoParaSGATransform.h"
#include "peoSeqPopEval.h"
#include "peoEvalFunc.h"
#include "peoParaPopEval.h"

View file

@ -51,16 +51,11 @@
//! The peoParaPopEval represents a wrapper for creating a functor capable of applying in parallel
//! an EO-derived evaluation functor. The class offers the possibility of chosing between a single-function evaluation
//! and an aggregate evaluation function, including several sub-evalution functions.
template< class EOT > class peoParaPopEval : public peoPopEval< EOT >
template< class EOT > class peoParaPopEval : public Service, public eoPopEvalFunc<EOT>
{
public:
using peoPopEval< EOT > :: requestResourceRequest;
using peoPopEval< EOT > :: resume;
using peoPopEval< EOT > :: stop;
using peoPopEval< EOT > :: getOwner;
//! Constructor function - an EO-derived evaluation functor has to be specified; an internal reference
//! is set towards the specified evaluation functor.
//!

View file

@ -1,57 +0,0 @@
/*
* <peoPopEval.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Sebastien Cahon, Alexandru-Adrian Tantar
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
#ifndef __peoPopEval_h
#define __peoPopEval_h
#include "core/service.h"
//! Interface for ParadisEO specific evaluation functors.
//! The <b>peoPopEval</b> class provides the interface for constructing ParadisEO specific evaluation functors.
//! The derived classes may be used as wrappers for <b>EO</b>-derived evaluation functors. In order to have an example,
//! please refer to the implementation of the <b>peoSeqPopEval</b> and <b>peoParaPopEval</b> classes.
template< class EOT > class peoPopEval : public Service, public eoPopEvalFunc<EOT>
{
public:
//! Interface function providing the signature for constructing an evaluation functor.
virtual void operator()( eoPop< EOT >& __tmp, eoPop< EOT >& __pop )=0;
};
#endif

View file

@ -1,87 +0,0 @@
/*
* <peoSeqPopEval.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Sebastien Cahon, Alexandru-Adrian Tantar
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
#ifndef __peoSeqPopEval_h
#define __peoSeqPopEval_h
#include <eoEvalFunc.h>
#include "peoPopEval.h"
//! Sequential evaluation functor wrapper.
//! The peoSeqPopEval class acts only as a ParadisEO specific sequential evaluation functor - a wrapper for incorporating
//! an <b>eoEvalFunc< EOT ></b>-derived class as evaluation functor. The specified EO evaluation object is applyied in an
//! iterative manner to each individual of a specified population.
template< class EOT > class peoSeqPopEval : public peoPopEval< EOT >
{
public:
//! Constructor function - it only sets an internal reference to point to the specified evaluation object.
//!
//! @param eoEvalFunc< EOT >& __eval - evaluation object to be applied for each individual of a specified population
peoSeqPopEval( eoEvalFunc< EOT >& __eval );
//! Operator for evaluating all the individuals of a given population - in a sequential iterative manner.
//!
//! @param eoPop< EOT >& __pop - population to be evaluated.
void operator()( eoPop< EOT >& __pop );
void operator()( eoPop< EOT > &__dummy,eoPop< EOT >&__pop);
private:
eoEvalFunc< EOT >& eval;
};
template< class EOT > peoSeqPopEval< EOT > :: peoSeqPopEval( eoEvalFunc< EOT >& __eval ) : eval( __eval )
{}
template< class EOT > void peoSeqPopEval< EOT > :: operator()( eoPop< EOT >& __dummy,eoPop< EOT >& __pop )
{
this->operator()(__pop);
}
template< class EOT > void peoSeqPopEval< EOT > :: operator()( eoPop< EOT >& __pop )
{
for ( unsigned i = 0; i < __pop.size(); i++ )
eval( __pop[i] );
}
#endif

View file

@ -1,100 +0,0 @@
/*
* <peoSeqTransform.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Sebastien Cahon, Alexandru-Adrian Tantar
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
#ifndef __peoSeqTransform_h
#define __peoSeqTransform_h
#include "peoTransform.h"
//! ParadisEO specific wrapper class offering the possibility of using EO derived transform operators.
//! The peoSeqTransform represent a wrapper for offering the possibility of using EO derived transform operators
//! along with the ParadisEO evolutionary algorithms. A minimal set of interface functions is also provided for creating the
//! link with the parallel architecture of the ParadisEO framework.
template< class EOT > class peoSeqTransform : public peoTransform< EOT >
{
public:
//! Constructor function - sets an internal reference towards the specified EO-derived transform object.
//!
//! @param eoTransform< EOT >& __trans - EO-derived transform object including crossover and mutation operators.
peoSeqTransform( eoTransform< EOT >& __trans );
//! Operator for applying the specified transform operators on each individual of the given population.
//!
//! @param eoPop< EOT >& __pop - population to be transformed by applying the crossover and mutation operators.
void operator()( eoPop< EOT >& __pop );
//! Interface function for providing a link with the parallel architecture of the ParadisEO framework.
virtual void packData()
{ }
//! Interface function for providing a link with the parallel architecture of the ParadisEO framework.
virtual void unpackData()
{ }
//! Interface function for providing a link with the parallel architecture of the ParadisEO framework.
virtual void execute()
{ }
//! Interface function for providing a link with the parallel architecture of the ParadisEO framework.
virtual void packResult()
{ }
//! Interface function for providing a link with the parallel architecture of the ParadisEO framework.
virtual void unpackResult()
{ }
private:
eoTransform< EOT >& trans;
};
template< class EOT > peoSeqTransform< EOT > :: peoSeqTransform( eoTransform< EOT >& __trans ) : trans( __trans )
{}
template< class EOT > void peoSeqTransform< EOT > :: operator()( eoPop< EOT >& __pop )
{
trans( __pop );
}
#endif

View file

@ -34,8 +34,8 @@ int main( int __argc, char** __argv )
eoGenContinue < Indi > genContPara (MAX_GEN);
eoCombinedContinue <Indi> continuatorPara (genContPara);
eoCheckPoint<Indi> checkpoint(continuatorPara);
eoEvalFuncPtr< Indi > mainEval( f );
eoEvalFuncCounter< Indi > eval(mainEval);
peoEvalFunc<Indi> mainEval( f );
peoParaPopEval <Indi> eval(mainEval);
eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
eoInitFixedLength < Indi > random (VEC_SIZE, uGen);
eoRankingSelect<Indi> selectionStrategy;
@ -43,7 +43,6 @@ int main( int __argc, char** __argv )
eoSegmentCrossover<Indi> crossover;
eoUniformMutation<Indi> mutation(EPSILON);
eoSGATransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
peoSeqTransform<Indi> eaTransform(transform);
eoPlusReplacement<Indi> replace;
eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace );
@ -57,35 +56,4 @@ int main( int __argc, char** __argv )
peo :: finalize();
if (getNodeRank()==1)
std::cout << "Final population :\n" << pop << std::endl;
// Algorithm
eoGenContinue < Indi > genContPara2 (MAX_GEN);
eoCombinedContinue <Indi> continuatorPara2 (genContPara2);
eoCheckPoint<Indi> checkpoint2(continuatorPara2);
eoEvalFuncPtr< Indi > mainEval2( f );
eoEvalFuncCounter< Indi > eval2(mainEval2);
eoUniformGenerator < double >uGen2 (INIT_POSITION_MIN, INIT_POSITION_MAX);
eoInitFixedLength < Indi > random2 (VEC_SIZE, uGen2);
eoRankingSelect<Indi> selectionStrategy2;
eoSelectNumber<Indi> select2(selectionStrategy2,POP_SIZE);
eoSegmentCrossover<Indi> crossover2;
eoUniformMutation<Indi> mutation2(EPSILON);
eoSGATransform<Indi> transform2(crossover2,CROSS_RATE,mutation2,MUT_RATE);
peoSeqTransform<Indi> eaTransform2(transform2);
eoPlusReplacement<Indi> replace2;
eoEasyEA< Indi > eaAlg2( checkpoint2, eval2, select2, transform2, replace2 );
// Population
eoPop < Indi > pop2;
pop2.append (POP_SIZE, random2);
// Wrapper
peo :: init( __argc, __argv );
peoWrapper parallelEA2( eaAlg2, pop2);
peo :: run();
peo :: finalize();
if (getNodeRank()==1)
std::cout << "Final population 2 :\n" << pop2 << std::endl;
}

View file

@ -31,8 +31,6 @@ int main( int __argc, char** __argv )
eoCombinedContinue <Indi> continuatorPara (genContPara);
eoCheckPoint<Indi> checkpoint(continuatorPara);
//eoEvalFuncPtr< Indi > mainEval( f );
//eoEvalFuncCounter< Indi > eval(mainEval);
peoEvalFunc<Indi> mainEval( f );
peoParaPopEval <Indi> eval(mainEval);
@ -43,8 +41,6 @@ int main( int __argc, char** __argv )
eoSegmentCrossover<Indi> crossover;
eoUniformMutation<Indi> mutation(EPSILON);
//eoSGATransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
//peoSeqTransform<Indi> eaTransform(transform);
peoParaSGATransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
eoPlusReplacement<Indi> replace;

View file

@ -42,13 +42,12 @@ int main (int __argc, char * * __argv)
eoPop <Route> pop (POP_SIZE, route_init);
eoGenContinue <Route> cont (NUM_GEN);
eoCheckPoint <Route> checkpoint (cont);
peoSeqPopEval <Route> eval (full_eval);
eoEvalFuncCounter< Route > eval(full_eval);
eoStochTournamentSelect <Route> select_one;
eoSelectNumber <Route> select (select_one, POP_SIZE);
eoSGATransform <Route> transform (order_cross, CROSS_RATE, city_swap_mut, MUT_RATE);
peoSeqTransform <Route> para_transform (transform);
eoEPReplacement <Route> replace (2);
eoEasyEA< Route > eaAlg( checkpoint, eval, select, para_transform, replace );
eoEasyEA< Route > eaAlg( checkpoint, eval, select, transform, replace );
peoWrapper parallelEA( eaAlg, pop);
peo :: run ();
peo :: finalize ();

View file

@ -56,13 +56,12 @@ int main (int __argc, char * * __argv)
peo :: init (__argc, __argv);
eoGenContinue <Route> cont (NUM_GEN);
eoCheckPoint <Route> checkpoint (cont);
peoSeqPopEval <Route> eval (full_eval);
eoEvalFuncCounter< Route > eval(full_eval);
eoStochTournamentSelect <Route> select_one;
eoSelectNumber <Route> select (select_one, POP_SIZE);
eoSGATransform <Route> transform (order_cross, CROSS_RATE, city_swap_mut, MUT_RATE);
peoSeqTransform <Route> para_transform (transform);
eoEPReplacement <Route> replace (2);
eoEasyEA< Route > eaAlg( checkpoint, eval, select, para_transform, replace );
eoEasyEA< Route > eaAlg( checkpoint, eval, select, transform, replace );
peoWrapper parallelEA( eaAlg, pop);
peo :: run ();
peo :: finalize ();