pymoo: multi-objective optimization in Python with NSGA2, NSGA3 and MOEAD
NSGA2, NSGA3, R-NSGA3, MOEAD, Genetic Algorithms (GA), Differential Evolution (DE), CMAES, PSO
At a glance
- What is it?
- pymoo is a Python framework for single and multi-objective optimization that ships NSGA2, NSGA3, R-NSGA3, MOEAD, GA, DE, CMAES and PSO behind one minimize() call. It suits engineers who need a Pareto front, not a single number, and it is the wrong tool when a gradient-based solver already solves your problem.
- Who is it for?
- Adopt pymoo if your problem has two or more conflicting objectives and you need a Pareto front rather than a single optimum, or if you want to compare NSGA2, NSGA3, MOEAD, DE, CMAES and PSO under one API without writing each algorithm yourself.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 11 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 23, 2026, and from our analysis. They are not legal advice.
Star history
- anyoptimization/pymoo3,002 ★ · +37
| Repository | 2026-09-25 | 2026-11-23 |
|---|---|---|
| anyoptimization/pymoo | 3k | 3k |
37 Stars in the last 59 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The problem pymoo solves: many objectives, one API
Most Python optimizers return one number. Real design problems rarely have one objective. A wing has to minimize drag and maximize lift. A schedule has to minimize cost and maximize fairness. When objectives conflict, there is no single best answer, only a set of trade-offs called the Pareto front, and the interesting engineering question is which point on that front you can live with. pymoo is built around that question. The README describes it as an open-source framework offering state of the art single- and multi-objective algorithms plus features related to multi-objective optimization such as visualization and decision making. The audience is therefore narrower than a general optimizer's: researchers and engineers who need population-based search over a conflicting objective space, and who want to swap NSGA2 for NSGA3 or MOEAD without rewriting their problem definition. If your problem is convex, differentiable and single-objective, pymoo is overhead. If it is not, the framework gives you the algorithms and the plotting in one dependency.
How pymoo structures a run: problem, algorithm, termination
The README's usage example exposes the whole architecture in four imports. A problem object comes from get_problem, an algorithm object is constructed with parameters such as pop_size, and minimize() wires them together with a termination criterion and a seed. The termination tuple ('n_gen', 200) means the run stops after 200 generations, not after a wall-clock budget or a tolerance. That separation matters: the problem knows how to evaluate a design vector, the algorithm knows how to select and vary a population, and the termination object knows when to stop. Because the three are independent, you can keep a problem definition and replace NSGA2 with NSGA3 by changing one import and one constructor call. The README also points to visualization as a first-class concern: Scatter() takes the problem's pareto_front() drawn as a line and the result's F matrix drawn as points, so the output of a run is a picture of how close the population came to the true front. The repository layout reinforces this: examples/ is split into algorithms, constraints, termination, visualization, problems and case_studies, which is the same decomposition the API exposes.
Installing pymoo and running NSGA2 on zdt1
The README requires a Python 3 environment and recommends miniconda3 or anaconda3. pyproject.toml sets requires-python to >= 3.10 and lists numpy, scipy, moocore, autograd, cma, matplotlib, alive_progress and Deprecated as runtime dependencies, so pip pulls all of them. The official release is on PyPI:
pip install -U pymooSome modules ship as compiled extensions for speed. The README gives a one-line check, and warns that you must not run it from inside a local pymoo source directory, otherwise you import the checkout rather than the installed package:
python -c "from pymoo.functions import is_compiled;print('Compiled Extensions: ', is_compiled())"If you want the current developer version instead, the README clones the repository and installs from the working tree:
git clone https://github.com/anyoptimization/pymoo
cd pymoo
pip install .For a first real run, the README's own example solves the zdt1 test problem with a population of 100 for 200 generations and plots the result against the known Pareto front:
from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.problems import get_problem
from pymoo.optimize import minimize
from pymoo.visualization.scatter import Scatter
problem = get_problem("zdt1")
algorithm = NSGA2(pop_size=100)
res = minimize(problem, algorithm, ('n_gen', 200), seed=1, verbose=True)
plot = Scatter()
plot.add(problem.pareto_front(), plot_type="line", color="black", alpha=0.7)
plot.add(res.F, color="red")
plot.show()What you should see: verbose output per generation, then a scatter plot with the true Pareto front as a black line and the population's objective values as red points. The closer the red sits to the black, the better the convergence and spread. The seed is fixed at 1 in the README, which makes the run reproducible; changing it changes the sampling.
Where pymoo gets in the way
The API is written for researchers, and that shows in the failure modes. First, the compiled extensions are optional but invisible: if the build against numpy failed, or you installed in an environment where Cython could not run, pymoo still works through pure Python and simply runs slower. The is_compiled() check is the only signal the README offers, and there is no warning at import time. Second, the termination criterion is explicit and unforgiving. ('n_gen', 200) is a budget, not a convergence test. If 200 generations is not enough, you get a front that has not converged and no error telling you so; if it is far too many, you pay for generations that change nothing. Third, everything is an in-process Python loop. There is no scheduler, no checkpoint file, no resume flag documented in the README. A long run that dies loses its population. Fourth, the framework is single-node. Nothing in the README describes distributed evaluation, so if your objective function is expensive enough to need a cluster, you are building that layer yourself around pymoo's evaluation step. Finally, pymoo expects you to write the objective as Python code. It is not a modeling language, and it will not read a symbolic formulation for you.
pymoo compared with DEAP and scipy.optimize
The honest comparison is not about which library is better but about which abstraction you want. DEAP is a general evolutionary computation toolkit: you assemble the individual representation, the operators, the selection scheme and the statistics yourself, which gives you freedom to build non-standard algorithms but leaves you responsible for the multi-objective machinery. pymoo inverts that. NSGA2, NSGA3, R-NSGA3, MOEAD, GA, DE, CMAES and PSO are provided as named algorithms, and the multi-objective parts, including the Pareto-front plotting shown in the README, come with them. If your goal is a working NSGA2 on a custom problem this afternoon, pymoo is less code. If your goal is to publish a new variation operator, DEAP's lower-level primitives may fit better. scipy.optimize is a different category entirely: it targets scalar objectives with gradient-based and direct methods, converges fast on smooth problems, and has no concept of a Pareto front. Reaching for pymoo when scipy.optimize would do trades milliseconds for seconds and a single answer for a set you then have to choose from. The choice is about the shape of the answer you need, not about which package is more capable.
Licence, releases and the cost of staying current
pymoo is Apache-2.0, both in the README badge and in pyproject.toml, which permits commercial use and modification provided the licence and notices are preserved. That is a permissive licence, but it is not legal advice and your organisation's policy governs. On maintenance: the repository is not archived, and the last push was on 2026-07-07. The release history shows 0.6.2 on 2026-06-28, 0.6.1.6 on 2025-11-25 and 0.6.1.5 on 2025-05-26, so the cadence is irregular rather than monthly, and the version numbers signal that point releases carry fixes. Upgrade cost is not zero because the dependency list is wide: numpy, scipy, moocore, autograd, cma, matplotlib, alive_progress and Deprecated all move independently, and the build system deliberately compiles against numpy>=2.0.0 so a single wheel loads on runtime numpy 1.19 and 2.x. The pyproject comment warns that an unpinned build numpy could compile against 2.x while a 1.x runtime silently falls back to slow pure-Python. In practice that means pinning your runtime numpy and re-running the is_compiled() check after any environment change is the cheap insurance.
Editorial conclusion
Adopt pymoo if your problem has two or more conflicting objectives and you need a Pareto front rather than a single optimum, or if you want to compare NSGA2, NSGA3, MOEAD, DE, CMAES and PSO under one API without writing each algorithm yourself. Do not adopt it for a single-objective differentiable problem where scipy.optimize already converges in milliseconds, and do not adopt it expecting a modeling language: pymoo optimizes Python functions you write, it does not parse equations. Before committing, verify that the compiled extensions are actually loaded by running the is_compiled() check outside the source directory, then reproduce the README's zdt1 example with seed=1 and confirm you get a front that tracks the black Pareto line.
Frequently asked questions
How do I install pymoo?
The README says to install a Python 3 environment first, recommending miniconda3 or anaconda3, and then run pip install -U pymoo for the official PyPI release. For the developer version it clones the repository and runs pip install . from inside the checkout.
How do I use pymoo for multi-objective optimization?
The README's example imports NSGA2, get_problem and minimize, builds a problem with get_problem("zdt1"), constructs NSGA2(pop_size=100), and calls minimize with a ('n_gen', 200) termination and seed=1. The result's F attribute holds the objective values, which can be plotted against the problem's pareto_front().
What is pymoo?
pymoo is an open-source Python framework for single- and multi-objective optimization that provides algorithms such as NSGA2, NSGA3, R-NSGA3, MOEAD, GA, DE, CMAES and PSO, along with visualization and decision-making features. It is distributed under Apache-2.0 and documented at pymoo.org.
How does pymoo compare with DEAP?
The README does not discuss DEAP. What the repository does show is that pymoo ships named, ready-made algorithms and multi-objective visualization, so the comparison depends on whether you want an assembled algorithm or the lower-level primitives to build your own.
What are the alternatives to pymoo?
The README names no alternatives. Based on what the project documents, scipy.optimize covers scalar, gradient-based problems and has no Pareto-front concept, while a general evolutionary toolkit leaves the multi-objective selection and plotting to you. pymoo's own scope is the algorithms and visualization it lists.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/anyoptimization-pymoo)Star history chart for your README
[](https://hysenlabs.com/projects/anyoptimization-pymoo)Was this useful?