pymoo

Solve single and multi-objective optimization problems in Python using evolutionary algorithms.

Updated Oct 7, 2022
One-click install
npx skills add https://github.com/tamagusko/linux-cfg --skill pymoo-tamagusko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pymoo
Source: https://github.com/tamagusko/linux-cfg/tree/main/dotfiles/claude/skills/pymoo
Command: npx skills add https://github.com/tamagusko/linux-cfg --skill pymoo-tamagusko

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pymoo, numpy, matplotlib, and includes scripts (resource) and references (resource) components.

What problem does it solve? Finding optimal trade-offs between conflicting objectives (cost vs. performance, weight vs. strength) requires specialized algorithms and careful configuration. This Skill provides structured workflows for defining optimization problems, selecting algorithms, handling constraints, and making decisions from Pareto fronts using the pymoo framework. ## Core Features & Use Cases - Multi-Objective Optimization: Run NSGA-II, NSGA-III, and MOEA/D to compute Pareto fronts for problems with 2 to 15+ conflicting objectives. - Constraint Handling & Decision Making: Apply feasibility-first, penalty, or constraint-as-objective methods, then select preferred solutions with MCDM techniques like Pseudo-Weights and knee point detection. - Benchmarks & Visualization: Test algorithms on ZDT, DTLZ, and WFG problems and visualize results with scatter plots, parallel coordinate plots, and petal diagrams. - Use Case: An engineer optimizing a structural design for minimum weight and maximum stiffness can define a custom constrained problem, run NSGA-II, visualize the Pareto front, and select a balanced solution using preference weights. ## Quick Start Use the pymoo skill to solve a bi-objective optimization problem with NSGA-II and visualize the resulting Pareto front.

Frequently Asked Questions about pymoo

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I solve a multi-objective optimization problem in Python?

Use pymoo's minimize() function with a problem definition and an algorithm like NSGA-II. The result object contains Pareto-optimal decision variables in result.X and objective values in result.F, which you can visualize with a Scatter plot.

NSGA-II vs NSGA-III: which algorithm should I use?

Use NSGA-II for problems with 2-3 objectives, where it provides well-distributed Pareto fronts with low overhead. Use NSGA-III for 4 or more objectives, since it uses reference directions to maintain diversity in high-dimensional objective spaces.

How do I define a custom constrained optimization problem in pymoo?

Extend the ElementwiseProblem class, set n_var, n_obj, n_ieq_constr, and bounds in __init__, then implement _evaluate to return objectives in out["F"] and constraints in out["G"]. Inequality constraints must be formulated as g(x) <= 0.

Does pymoo support constrained optimization?

Yes, pymoo handles constraints through feasibility-first selection by default, penalty methods via ConstraintsAsPenalty, constraint-as-objective conversion, and specialized algorithms like SRES and ISRES for heavily constrained problems.

Why is my NSGA-III optimization not producing a good Pareto front?

NSGA-III requires properly generated reference directions using get_reference_directions with the das-dennis method. Also check that the population size matches the reference directions, increase generations, and verify objective scaling.

How do I select one solution from a Pareto front?

Normalize the objective values to [0, 1], then apply an MCDM method such as PseudoWeights with your preference weights, or use knee point detection for balanced trade-offs. The selected index maps back to the decision variables in result.X.