When running the code, you might have seen some printouts (when using verbose=True), which might or might not have made a lot of sense to you. Below, a quick summary of possible printouts you might encounter is provided.

Types of Output




The current number of generations or iterations until this point.


The number of function evaluations so far.


For multi-objective problems, the number of non-dominated solutions of the optima found.

cv (min)

The minimum constraint violation (CV) in the current population

cv (avg)

The average constraint violation (CV) of the current population


For single-objective problems, the best function value found so far.


For single-objective problems, the best gap to the optimum (only printed if the optimum is known).


For multi-objective problems, the change of the indicator (ideal, nadir, f) over the last few generations (only printed if the Pareto-front is unknown). For more information we encourage you to have a look at the corresponding publication ([22], pdf).


For multi-objective problems, the performance indicator (only printed if the Pareto-front is known).

The default printouts can vary from algorithm to algorithm and from problem to problem. The type of printout is based on an implementation of the Display object. If you like to customize the output, you can also write your own, as shown below:

from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.factory import get_problem
from pymoo.optimize import minimize
from pymoo.util.display import Display
import numpy as np

class MyDisplay(Display):

    def _do(self, problem, evaluator, algorithm):
        super()._do(problem, evaluator, algorithm)
        self.output.append("metric_a", np.mean(algorithm.pop.get("X")))
        self.output.append("metric_b", np.mean(algorithm.pop.get("F")))

problem = get_problem("zdt2")

algorithm = NSGA2(pop_size=100)

res = minimize(problem,
               ('n_gen', 10),
n_gen |  n_eval |   metric_a   |   metric_b
    1 |     100 |  0.500122773 |  2.958637098
    2 |     200 |  0.457137310 |  2.716284231
    3 |     300 |  0.424878151 |  2.540654646
    4 |     400 |  0.394032982 |  2.404824717
    5 |     500 |  0.370407264 |  2.295560288
    6 |     600 |  0.352432747 |  2.213395359
    7 |     700 |  0.328691523 |  2.099318577
    8 |     800 |  0.309089487 |  1.997100714
    9 |     900 |  0.291940743 |  1.918699384
   10 |    1000 |  0.272572521 |  1.832162449

You have to inherit your custom display MyDisplay from the Display class for your own printout logic. The _do function will be called in each iteration, and the Problem, Evaluator and Algorithm are provided to you. For each column, you can add an entry to self.output, which will be formatted and then printed.