Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial_population not effectively used/retained for multiobjective problems? #279

Open
kaurao opened this issue Feb 19, 2024 · 4 comments
Labels
question Further information is requested

Comments

@kaurao
Copy link

kaurao commented Feb 19, 2024

Hi,

Thanks for PyGAD, it's a great resource.
I am trying to use it for an multiobjective optimization task. I have a good idea for what good solutions could be so I am providing them via the initial_population argument. However, some of those solutions are bot being used, I think.

My set up is as follows.

ga_instance = pygad.GA(num_genes=68,
                       sol_per_pop=100,
                       initial_population=initial_population,
                       num_generations=100,
                       num_parents_mating=np.round(sol_per_pop/2).astype(int),
                       parent_selection_type=parent_selection_type,
                       gene_space={'low': 0, 'high': 1},
                       crossover_type="uniform",
                       mutation_type=None,
                       mutation_num_genes=[5, 1],
                       keep_elitism=10,
                       fitness_func=fitness_func,
                       on_generation=on_generation)

The image shows the final front 0 as blue dots and the red cross as one of the initial solutions that I provided whiuch apparently "disappeared".

image

I will appreciate any tips on how to set this up properly using PyGAD, thanks!

@kaurao
Copy link
Author

kaurao commented Feb 19, 2024

My guess is the difference is coming from parent_selection_type="tournament_nsga2" (the details and the figure above) versus parent_selection_type="nsga2" which seems to work as expected (see the figure below).

image

@ahmedfgad ahmedfgad added the question Further information is requested label Feb 19, 2024
@ahmedfgad
Copy link
Owner

tournament_nsga2 and nsga2 are different types of parent selectors for multi-objective optimization using NSGA-II.

tournament_nsga2 applies a tournament between the candidates and parents are selected randomly. This means the solution with the best fitness is not guaranteed to be selected. In contrast, nsga2 always select the best solutions as parents.

@kaurao
Copy link
Author

kaurao commented Feb 22, 2024

Makes sense. Can you please provide referene(s) for tournament_nsga2 I have not come across it before. Thanks!

@ahmedfgad
Copy link
Owner

These are some resources that describes tournament selection for NSGA-II:

You can definitely have more resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants