anyoptimization / pymoo

NSGA2, NSGA3, R-NSGA3, MOEAD, Genetic Algorithms (GA), Differential Evolution (DE), CMAES, PSO
https://pymoo.org
Apache License 2.0
2.28k stars 392 forks source link

Giving a custom initial population #366

Closed haritha-paul closed 1 year ago

haritha-paul commented 1 year ago

Hi, I've been using pymoo in my multi-objective optimization problem. I have the initial population for the multi-objective algorithm (say, NSGA-2) generated by another algorithm.

How can I feed a custom input population in pymoo? Is there a provision for that? I want to give the population list generated into NSGA2 algorithm for genetic operations.

Note: My input population are floating point numbers.

bruscalia commented 1 year ago

Hi, @haritha-paul ! You can pass your previous population (or numpy array) as the sampling argument in either the new algorithm initialization or as a keyword argument to the minimize interface, which will override the sampling operator of the algorithm.

Let me know if it works for you!

haritha-paul commented 1 year ago

Thank you so much for your reply. I'll try and let you know if it works!

On Mon, 16 Jan, 2023, 2:43 am Bruno Scalia C. F. Leite, < @.***> wrote:

Hi, @haritha-paul https://github.com/haritha-paul ! You can pass your previous population (or numpy array) as the sampling argument in either the new algorithm initialization or as a keyword argument to the minimize interface, which will override the sampling operator of the algorithm.

Let me know if it works for you!

— Reply to this email directly, view it on GitHub https://github.com/anyoptimization/pymoo/issues/366#issuecomment-1383254506, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEAUNEXTXVAZJIR7F73LGGLWSRR7FANCNFSM6AAAAAAT4AMBOU . You are receiving this because you were mentioned.Message ID: @.***>

blankjul commented 1 year ago

@haritha-paul You can also directly follow this tutorial available in the documentation: https://pymoo.org/customization/initialization.html

Feel free to reopen this issue if not resolved.