ECJ-INTEREST-L Archives

October 2008

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Date:
Wed, 1 Oct 2008 15:14:02 -0400
MIME-version:
1.0
Reply-To:
Content-type:
text/plain; charset=windows-1252; format=flowed
Subject:
From:
Sean Luke <[log in to unmask]>
In-Reply-To:
Content-transfer-encoding:
8BIT
Comments:
To: ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Parts/Attachments:
text/plain (201 lines)
Besides a possible bug in your code, there's three possibilities I can 
think of:

1. There's a bug in ECJ or in JGAP or GALib with regard to the thing you 
picked.

2. There's a difference in interpretation of your parameters among the 
algorithms.  Not knowing JGAP and GALib as well as ECJ, I cannot speak 
for them.

3. Random number generators?  JGAP and GALib both have bad RNG choices. 
  Could this have an effect?

Sean


Cem Safak SAHIN wrote:
> Hi there,
> 
> I am bechmarking three different GA libraries (ECJ, JGAP, and GALib 
> (C++)). The parameter file, the fitness function, and the my mutation 
> function are at the end of this email. The length of chromosome is 600 and 
> subpopulation size is 20. I am using default crossover function (source 0 
> and source 1 --> FitProportionateSelection). Fitness function is 
> Kozafitness (it is easier for me to solve minimization problems).
> The other two libraries converge around 20,000 iterations. However, ECJ 
> converges after 90,000 iterations. If I 
> 
> I wanna learn your instincts about convergence rate. Isn't it too slow? 
> (Whether, I am coding something wrong or someone has the similar 
> convergence rate problem for fitness value) 
> 
> Note: I am using my own mutation function because the bit selected for 
> mutation should be changed from a value in the predefined vector.
> 
> Thanks in advance,
> 
> Safak
> -----------FITNESS FUNCTION-----------------------------------
> fitness = 0;
> for (i<genome.length){
>     fitness += (value of genome – (1/genome.length x i))2
> }
> 
> ----------PARAMETERS FILE---------------------------------------
> 
> parent.0     = simple.params
> 
> verbosity     = 0
> 
> stat       = ec.GALIB.ES1.MyStat
> 
> eval.problem               = ec.GALIB.ES1.MyGAs
> 
> pop.subpop.0.breeder      = ec.Simple.SimpleBreeder
> 
> pop.subpop.0.species.pipe     = 
> ec.GALIB.ES1.MyMutation 
> 
> pop.subpop.0.species.pipe.source.0    = 
> ec.vector.breed.VectorCrossoverPipeline
> pop.subpop.0.species.pipe.source.0.source.0   = 
> ec.select.FitProportionateSelection
> pop.subpop.0.species.pipe.source.0.source.1   = 
> ec.select.FitProportionateSelection
> pop.subpop.0.species.pipe.source.0.toss = false
> 
> pop.subpop.0.species    = 
> ec.vector.FloatVectorSpecies
> pop.subpop.0.species.min-gene   = 0.0f
> pop.subpop.0.species.max-gene   = 1.0f
> 
> pop.subpop.0.species.ind   = 
> ec.vector.FloatVectorIndividual
> pop.subpop.0.species.genome-size  = 600
> pop.subpop.0.species.crossover-type  = one
> pop.subpop.0.species.crossover-prob  = 0.9
> 
> pop.subpop.0.species.fitness  = ec.gp.koza.KozaFitness
> 
> breed.elite.0     = 1
> 
> pop.subpop.0.size     = 20
> 
> pop.subpop.0.file = initPop.params
> 
> generations      = 100000
> 
> function.delay     = false
> #true
> 
> pop.subpop.0.species.mutation-prob  = 0.002
> 
> seed.0      = time
> 
> pop.subpop.0.duplicate-retries  = 0
> 
> 
> ---------------------- MY MUTATION----------------------
> package ec.GALIB.ES1;
> 
> import ec.BreedingPipeline;
> import ec.EvolutionState;
> import ec.Individual;
> import ec.util.Parameter;
> import ec.vector.FloatVectorIndividual;
> import ec.vector.FloatVectorSpecies;
> import ec.vector.VectorDefaults;
> 
> 
> public class MyMutation extends BreedingPipeline{
> 
>  public static final String P_MUTATION = "mutate";
>  public static final int NUM_SOURCES = 1;
>  public RandomGenerator rg = new RandomGenerator();
>   
>  @Override
>  public int numSources() {
>   // TODO Auto-generated method stub
>   return NUM_SOURCES;
>  }
>  
>  @Override
>  public int produce(final int min, final int max, final int start, 
> final int subpopulation,
>    final Individual[] inds, final EvolutionState 
> state, final int thread){
>   // TODO Auto-generated method stub
>   
>   int n=sources[0].produce(min, max, start, subpopulation, 
> inds, state, thread);
>   Parameter myBase = new Parameter("function");
>    
>   if (!(sources[0] instanceof BreedingPipeline)){
>    for (int q=start;q<n+start;q++){
>     inds[q]=(Individual) inds[q].clone();
>     }  
>   }
>   //initialize random number generator
>   rg.SetState(state);
>   rg.SetThread(thread);
>   
>   FloatVectorSpecies s = (FloatVectorSpecies)(inds
> [0].species);
>   FloatVectorIndividual ind;
>   for(int q=start;q<start+n;q++){
>    ind = (FloatVectorIndividual)inds[q];
>    if (s.mutationProbability>0.0){
>     if (state.random[thread].nextBoolean
> (s.mutationProbability)){
>     int a = state.random[0].nextInt(600);
> 
>      ind.genome[a]=(float)(rg.GetRandom
> (a));
>     }
>    }   
>    (inds[q]).evaluated=false;  
>   }
>   
>   return n;
>  }
> 
>  @Override
>  public Parameter defaultBase() {
>   // TODO Auto-generated method stub
>   return VectorDefaults.base().push(P_MUTATION);
>  }
>  
>  public class RandomGenerator{
>   int type = 0; // 0-->Gaussian, 1-->Cauchy
>   int thread;
>   EvolutionState state;
>   float GetRandom(float a){
>    float rnum = 0.0f;
>    int k = state.random[thread].nextInt(9);
>    rnum = ES_Java_1._chromosomes[(int)a][k];
>    /*if (type == 0){
>     rnum = err*(float)state.random
> [thread].nextGaussian();
>    }
>    else{
>     rnum=(float)Math.tan(3.1415926536f*
> (state.random[thread].nextFloat()-0.5f));
>    }*/
>    return rnum;
>   }
>   
>   void SetState(final EvolutionState s){
>    state =s;
>   }
>   
>   void SetThread(final int t){
>    thread = t;
>   }
>   
>  }
> 
> 
> 
> }

ATOM RSS1 RSS2