From 3e04ef220bed571eaabf8ef9dca3c7d0b73cfb11 Mon Sep 17 00:00:00 2001 From: legrand Date: Tue, 9 Oct 2007 08:39:54 +0000 Subject: [PATCH] don't need parallel PSO git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@693 331e1502-861f-0410-8da2-ba01fb791d7f --- .../paradiseo-peo/src/peoEvalFuncPSO.h | 40 --------- .../paradiseo-peo/src/peoPSO.h | 85 ------------------- 2 files changed, 125 deletions(-) delete mode 100644 tags/paradiseo-ix86-1.0/paradiseo-peo/src/peoEvalFuncPSO.h delete mode 100644 tags/paradiseo-ix86-1.0/paradiseo-peo/src/peoPSO.h diff --git a/tags/paradiseo-ix86-1.0/paradiseo-peo/src/peoEvalFuncPSO.h b/tags/paradiseo-ix86-1.0/paradiseo-peo/src/peoEvalFuncPSO.h deleted file mode 100644 index 7f94974b8..000000000 --- a/tags/paradiseo-ix86-1.0/paradiseo-peo/src/peoEvalFuncPSO.h +++ /dev/null @@ -1,40 +0,0 @@ -// "peoEvalFuncPSO.h" - -// (c) OPAC Team, October 2007 - -/* - Contact: clive.canape@inria.fr -*/ - -#ifndef PEOEVALFUNCPSO_H -#define PEOEVALFUNCPSO_H - -#include - -/** peoEvalFuncPSO: This class - * takes an existing function pointer and converts it into a evaluation - * function class. - */ - -#ifdef _MSC_VER -template< class POT, class FitT = POT::Fitness, class FunctionArg = const POT& > -#else -template< class POT, class FitT = typename POT::Fitness, class FunctionArg = const POT& > -#endif -struct peoEvalFuncPSO: public eoEvalFunc { - - peoEvalFuncPSO( FitT (* _eval)( FunctionArg ) ) - : eoEvalFunc(), evalFunc( _eval ) {}; - - //Applies the evaluation function to a PEO - virtual void operator() ( POT & _peo ) - { - _peo.fitness((*evalFunc)( _peo )); - }; - - private: - FitT (* evalFunc )( FunctionArg ); -}; - -#endif - diff --git a/tags/paradiseo-ix86-1.0/paradiseo-peo/src/peoPSO.h b/tags/paradiseo-ix86-1.0/paradiseo-peo/src/peoPSO.h deleted file mode 100644 index 83ef1154a..000000000 --- a/tags/paradiseo-ix86-1.0/paradiseo-peo/src/peoPSO.h +++ /dev/null @@ -1,85 +0,0 @@ -// "peoPSO.h" - -// (c) OPAC Team, October 2007 - -/* - Contact: clive.canape@inria.fr -*/ - -#ifndef __peoPSO_h -#define __peoPSO_h - -#include -#include -#include -#include -#include -#include -#include "peoPopEval.h" -#include "core/runner.h" -#include "core/peo_debug.h" - - -template < class POT > class peoPSO : public Runner { - -public: - - - // Constructor for the Particle Swarm Optimization - peoPSO( - eoContinue< POT >& __cont, - peoPopEval< POT >& __pop_eval, - eoVelocity < POT > &_velocity, - eoFlight < POT > &_flight); - - // Particle Swarm Optimization function - a side effect of the fact that the class is derived from the Runner class - // thus requiring the existence of a run function, the algorithm being executed on a distinct thread. - void run(); - - // Function operator for specifying the population to be associated with the algorithm. - void operator()( eoPop< POT >& __pop ); - -private: - - eoContinue< POT >& cont; - peoPopEval< POT >& pop_eval; - eoPop< POT >* pop; - eoVelocity < POT > &velocity; - eoFlight < POT > &flight; -}; - - -template < class POT > peoPSO< POT > :: peoPSO( - - eoContinue< POT >& __cont, - peoPopEval< POT >& __pop_eval, - eoVelocity < POT > &__velocity, - eoFlight < POT > &__flight - ) : cont( __cont ), pop_eval(__pop_eval ),velocity( __velocity),flight( __flight) -{ - pop_eval.setOwner( *this ); -} - - -template< class POT > void peoPSO< POT > :: operator ()( eoPop< POT >& __pop ) { - - pop = &__pop; -} - - -template< class POT > void peoPSO< POT > :: run() { - - printDebugMessage( "Performing the first evaluation of the population." ); - do { - printDebugMessage( "Performing the velocity evaluation." ); - velocity.apply ( *pop ); - printDebugMessage( "Performing the flight." ); - flight.apply ( *pop ); - printDebugMessage( "Performing the evaluation." ); - pop_eval(*pop); - velocity.updateNeighborhood( *pop ); - } while ( cont( *pop ) ); -} - - -#endif