Pymoo is an open-source Python library for multi-objective optimization. It provides state-of-the-art single- and multi-objective optimization algorithms, along with features for visualization and decision-making. Currently at version 0.6.1.6, the library maintains an active development cadence with regular updates and bug fixes.
pip install -U pymooVerified import paths — ran on the pinned version, not inferred.
This quickstart defines a custom constrained multi-objective optimization problem, initializes the NSGA-II algorithm, sets a termination criterion based on the number of generations, runs the optimization, and visualizes the resulting Pareto front. Note that custom problems should now inherit from `pymoo.core.problem.Problem` or `ElementwiseProblem`.
Update import paths to reflect the new structure, e.g., `from pymoo.algorithms.moo.nsga2 import NSGA2` instead of `from pymoo.algorithms.nsga2 import NSGA2` (old paths are approximate).
Directly import and instantiate classes (e.g., `NSGA2(pop_size=100)`) instead of using factory functions (e.g., `get_algorithm("nsga2", pop_size=100)`).Adjust custom termination logic to return a float, or use tuple-based termination criteria (e.g., `('n_gen', 200)`).Upgrade `pymoo` to version 0.6.1.3 or newer, or downgrade `numpy` to a version less than 2.0.0 (e.g., `numpy<2`). `autograd` is now optional in `pymoo >= 0.6.1.3`.
Understand the differences and select the appropriate problem definition for your use case. `Problem` is generally preferred for population-based algorithms due to vectorized evaluation efficiency, while `ElementwiseProblem` simplifies custom parallelization.