Différences entre les versions de « EASEA defined sections »

De
Aller à la navigation Aller à la recherche
Ligne 19 : Ligne 19 :
  
 
;Genome optimization only
 
;Genome optimization only
 +
\GenomeClass::optimiser :
 +
  float pas = 0.001;
 +
  Genome.x[currentIteration%SIZE]+=pas;
 +
\end
  
 
;Complete local optimizer
 
;Complete local optimizer

Version du 22 novembre 2010 à 15:25

Memetic specific field

Genome Optimiser

Description :
The optimiser field is a Genome specific field. It is meant to contain the function defining the way an individual will be locally optimized n times. The function will hence be called sequentially as many times as the user desires for each individual.

EASEA gives the user two possibilities when designingé their local optimization function :

  1. The user can choose to design the function that will enhance the genome of their individuals only in which case the rest of the local optimizer (i.e. creating the local optimizing loop, checking if an individual has improved or not, storing temporary individuals, calling of the evaluation function, etc ...) will be taken care of by the EASEA memetic algorithm. The function will have to be called as many times as specified by the Number of optimisation iterations parameter.
  2. The user can choose to write the complete local optimizer. This way, he will have the complete freedom to design a more complex and specific optimizer, but he will also have to deal with the creation of the local optimization loop, the management of temporary individuals, the calling of the evaluation function etc... The Number of optimisation iterations parameter will have to be set to 1 as the function desigend by the user will contain it's own optimization loop requiring it's own specific number of optimization iterations.


EASEA syntax :

\GenomeClass::optimiser :
     ...
\end

Examples :

Genome optimization only
\GenomeClass::optimiser :
 float pas = 0.001;
 Genome.x[currentIteration%SIZE]+=pas;
\end
Complete local optimizer
\GenomeClass : : optimiser	:	//	Optimises	the	Genome float pas=0.001;
 float fitnesstmp = Genome. fitness ; float tmp[SIZE]; int index = 0;
 for(int i=0; i<SIZE; i++) tmp[ i ] = Genome.x[ i ];
 for(int i=0; i<100; i++){ tmp[index] += pas;
  fitnesstmp = Weierstrass(tmp, SIZE); //fitnesstmp = rosenbrock(tmp);
  if(fitnesstmp < Genome.fitness){ 
   Genome. fitness = fitnesstmp ;
   Genome.x[ index ] = tmp[ index ];
  }
  else {
   fitnesstmp = Genome.fitness;
   tmp[ index ] = Genome.x[ index ];
  
   if( pas < 0 )
    index = ( index + 1)%SIZE;
    
   pas *= -1;
  }
 }
\ end