# ParadisEO-PEOMovingObjects: peoEA.h Source File

# peoEA.h

    00001 /*
    00002 * <peoEA.h>
    00003 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
    00004 * (C) OPAC Team, LIFL, 2002-2007
    00005 *
    00006 * Sebastien Cahon, Alexandru-Adrian Tantar
    00007 *
    00008 * This software is governed by the CeCILL license under French law and
    00009 * abiding by the rules of distribution of free software.  You can  use,
    00010 * modify and/ or redistribute the software under the terms of the CeCILL
    00011 * license as circulated by CEA, CNRS and INRIA at the following URL
    00012 * "http://www.cecill.info".
    00013 *
    00014 * As a counterpart to the access to the source code and  rights to copy,
    00015 * modify and redistribute granted by the license, users are provided only
    00016 * with a limited warranty  and the software's author,  the holder of the
    00017 * economic rights,  and the successive licensors  have only  limited liability.
    00018 *
    00019 * In this respect, the user's attention is drawn to the risks associated
    00020 * with loading,  using,  modifying and/or developing or reproducing the
    00021 * software by the user in light of its specific status of free software,
    00022 * that may mean  that it is complicated to manipulate,  and  that  also
    00023 * therefore means  that it is reserved for developers  and  experienced
    00024 * professionals having in-depth computer knowledge. Users are therefore
    00025 * encouraged to load and test the software's suitability as regards their
    00026 * requirements in conditions enabling the security of their systems and/or
    00027 * data to be ensured and,  more generally, to use and operate it in the
    00028 * same conditions as regards security.
    00029 * The fact that you are presently reading this means that you have had
    00030 * knowledge of the CeCILL license and that you accept its terms.
    00031 *
    00032 * ParadisEO WebSite : http://paradiseo.gforge.inria.fr
    00033 * Contact: paradiseo-help@lists.gforge.inria.fr
    00034 *
    00035 */
    00036
    00037 #ifndef __peoEA_h
    00038 #define __peoEA_h
    00039
    00040 #include <eoContinue.h>
    00041 #include <eoEvalFunc.h>
    00042 #include <eoSelect.h>
    00043 #include <eoPopEvalFunc.h>
    00044 #include <eoReplacement.h>
    00045
    00046 #include "peoPopEval.h"
    00047 #include "peoTransform.h"
    00048 #include "core/runner.h"
    00049 #include "core/peo_debug.h"
    00050
    00052
    00082 template < class EOT > class peoEA : public Runner {
    00083
    00084 public:
    00085
    00097         peoEA(
    00098                 eoContinue< EOT >& __cont,
    00099                 peoPopEval< EOT >& __pop_eval,
    00100                 eoSelect< EOT >& __select,
    00101                 peoTransform< EOT >& __trans,
    00102                 eoReplacement< EOT >& __replace
    00103         );
    00104
    00107         void run();
    00108
    00112         void operator()( eoPop< EOT >& __pop );
    00113
    00114 private:
    00115
    00116
    00117         eoContinue< EOT >& cont;
    00118         peoPopEval< EOT >& pop_eval;
    00119         eoSelect< EOT >& select;
    00120         peoTransform< EOT >& trans;
    00121         eoReplacement< EOT >& replace;
    00122         eoPop< EOT >* pop;
    00123 };
    00124
    00125
    00126 template < class EOT > peoEA< EOT > :: peoEA(
    00127
    00128                                 eoContinue< EOT >& __cont,
    00129                                 peoPopEval< EOT >& __pop_eval,
    00130                                 eoSelect< EOT >& __select,
    00131                                 peoTransform< EOT >& __trans,
    00132                                 eoReplacement< EOT >& __replace
    00133
    00134                 ) : cont( __cont ), pop_eval( __pop_eval ), select( __select ), trans( __trans ), replace( __replace )
    00135 {
    00136
    00137         trans.setOwner( *this );
    00138         pop_eval.setOwner( *this );
    00139 }
    00140
    00141
    00142 template< class EOT > void peoEA< EOT > :: operator ()( eoPop< EOT >& __pop ) {
    00143
    00144         pop = &__pop;
    00145 }
    00146
    00147
    00148 template< class EOT > void peoEA< EOT > :: run() {
    00149
    00150         printDebugMessage( "performing the first evaluation of the population." );
    00151         pop_eval( *pop );
    00152
    00153         do {
    00154
    00155                 eoPop< EOT > off;
    00156
    00157                 printDebugMessage( "performing the selection step." );
    00158                 select( *pop, off );
    00159                 trans( off );
    00160
    00161                 printDebugMessage( "performing the evaluation of the population." );
    00162                 pop_eval( off );
    00163
    00164                 printDebugMessage( "performing the replacement of the population." );
    00165                 replace( *pop, off );
    00166
    00167                 printDebugMessage( "deciding of the continuation." );
    00168
    00169         } while ( cont( *pop ) );
    00170 }
    00171
    00172
    00173 #endif