luca-scr / GA

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

Confusing documentation of ga solution object #36

Closed dslate1 closed 4 years ago

dslate1 commented 4 years ago

The documentation of the solution field of the object returned by a call to ga in GA_3.2 says "solution the value(s) of the decision variables giving the best fitness at the final iteration." But the solution object returned by ga seems to be a matrix, e.g.: "num [1:5, 1:5000]". The 2nd dimension of 5000 is the number of decision variables, but I don't understand what the first dimension of 5 means. Does the returned matrix contain several possible solutions?

Is the documentation in error or am I just confused?

Thanks.

luca-scr commented 4 years ago

It may happen that the same fitness values is attained by more than one solution. You may check yourself by evaluating the fitness of the solutions provided. This is less likely if the decision variables are real-valued, but it may well happen in the binary case. So, the solution slot is always a matrix of dimension number of solutions x number of decision variables.