luca-scr / GA

An R package for optimization using genetic algorithms
http://luca-scr.github.io/GA/
91 stars 29 forks source link

Summary of number of calls to fitness function #28

Closed enriquegit closed 5 years ago

enriquegit commented 5 years ago

This is a suggestion to include in the summary how many times the fitness function was called. This is important when comparing experiments with different parameters.

By looking at the code it seems that currently, this information is not stored anywhere. Maybe have a counter and increment it somewhere between lines 225-242 of ga.R ?

Is there a workaround? Was thinking of opening a file inside the fitness function and write a counter but would be very inneficient and if using parallel > 1 some synch issues could arise.

luca-scr commented 5 years ago

If no local search is involved, nor memoization is involved, then the total number of fitness function calls is given by the number of iterations times the population size.

Paul-AntoineLeboeuf commented 4 years ago

I used a pointer to extract all of the individuals that were given to my fitness function with the goal to have a matrix of all the individuals involved in the process. At the same time, it gives me how many time my fitness function was called. It doesn't give me a matrix of nrow equal to the number of iterations times the population size. Some generation doesn't have the good numbers of individuals. Is it because the probability crossover is not equal to 1, and so less offspring are created ? Thanks

luca-scr commented 4 years ago

I can't debug your code if you don't provide it with a minimal reproducible example (and even in this case I have to find the time to do that). Population size is always constant across generations. The probability crossover (or mutation) has effect only the chance to apply crossover (or mutation) genetic operator.