Skip to content

Variable population size #224

Description

@timorichert

Dear PyGAD team,
Thinking how evolutionary algorithms work, I was wondering if it could make sense to start off with a large population, and reduce the population size over time, to start with more population diversity, and narrowing it down as the algorithm gets closer to the optimum. Making the input parameter sol_per_pop a list to be able to define population size for each generation could be a straightforward implementation. Do you think this is something worth considering?
All the best,
Timo Richert

Activity

  1. ahmedfgad commented on Aug 16, 2023

    @ahmedfgad
    Owner

    Thanks @timorichert for your suggestion.

    At the moment, we expect a fixed-size population. This should be considered for support in the future.

  2. timorichert commented on Sep 20, 2023

    @timorichert
    Author

    Thanks for your consideration @ahmedfgad.

  3. vibeeshan025 commented on Oct 30, 2023

    @vibeeshan025

    Just my 2 cents, Though I have extensive experience in implementing my own GA implementations, I am new to your library.
    Does it really make sense to implement this? Other than a few performance improvements, are we really going to get any advantage in implementing this? Moreover doesn't it lead to more local max solutions if we reduce the population size over time?

    @timorichert could you please let us know a good use case for this? I am just curious to know.

  4. ahmedfgad commented on Nov 2, 2023

    @ahmedfgad
    Owner

    Just my 2 cents, Though I have extensive experience in implementing my own GA implementations, I am new to your library. Does it really make sense to implement this? Other than a few performance improvements, are we really going to get any advantage in implementing this? Moreover doesn't it lead to more local max solutions if we reduce the population size over time?

    @timorichert could you please let us know a good use case for this? I am just curious to know.

    @vibeeshan025, one motivation I am considering to implement this feature is to dynamically change the parameters over time in case there is little or no improvements. This does not only apply to the population size but to the other parameters. For example, the GA may start with 5 solutions per population. If there is no improvement over K consecutive generations, then the population size increases from 5 to 10. This enables the GA to explore more solutions quickly.

    Note sure if @timorichert have something else!

  5. timorichert commented on Nov 2, 2023

    @timorichert
    Author

    My thinking was that in the first generation, the population size could be chosen large, simply to cover a large variation of genes and associated fitness.

    Many solutions with bad fitness would drop out when reducing the population size to an X times smaller one, and the subsequent optimization over the remaining generations would be much quicker due to the reduced size.

    It could potentially improve the chance to find the global maximum by increasing the likelihood to have a solution nearby in the initial population.

    I guess it really depends on the optimization problem whether or not this makes sense!?

  6. ahmedfgad commented on Nov 10, 2023

    @ahmedfgad
    Owner
  7. juan11iguel commented on May 15, 2024

    @juan11iguel

    Variable population size is a topic of discussion in literature [1]:

    In a traditional genetic algorithm (GA), the population size is set by the user to a fixed value at the beginning of the search and remains constant through the entire run. Having to specify this initial parameter value is problematic in many ways. If it is too small the GA may not be able to reach high quality solutions. If it is too large the GA spends unnecessary computational resources. Finding an adequate population size is a difficult task. It has been shown, both theoretically and empirically, that the optimal size is something that differs from problem to problem. Moreover, some researchers have observed that at different stages of a single run, different population sizes might be optimal.

    image

    It would be interesting to consider adding one or more dynamic population strategies to the library, as far as I know, not even MATLAB's implementation has it.

    [1] Lobo, Fernando G., and Cláudio F. Lima. “Adaptive Population Sizing Schemes in Genetic Algorithms.” In Parameter Setting in Evolutionary Algorithms, edited by Fernando G. Lobo, Cláudio F. Lima, and Zbigniew Michalewicz, 185–204. Studies in Computational Intelligence. Berlin, Heidelberg: Springer, 2007. https://doi.org/10.1007/978-3-540-69432-8_9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions