Minimize¶
The minimize
function provides the external interface for any kind of optimization to be performed. The minimize method arguments and options look as follows:
def minimize(problem,
algorithm,
termination=None,
seed=None,
verbose=False,
display=None,
callback=None,
return_least_infeasible=False,
save_history=False
)
problem
: A Problem object that contains the problem to be solved.algorithm
: An Algorithm objective which represents the algorithm to be used.termination
: A Termination object or a tuple defining when the algorithm has terminated. If not provided, a default termination criterion will be used. Purposefully, we list the termination as a parameter and not an option. Specific algorithms might need some refinement of the termination to work reliably.seed
: Most algorithms underly some randomness. Setting the seed to a positive integer value ensures reproducible results. If not provided, a random seed will be set automatically, and the used integer will be stored in the Result object.verbose
: Boolean value defining whether the output should be printed during the run or not.display
: You can overwrite what output is supposed to be printed in each iteration. Therefore, a custom Display object can be used for customization purposes.save_history
: A boolean value representing whether a snapshot of the algorithm should be stored in each iteration. If enabled, the Result object contains the history.return_least_infeasible
: Whether if the algorithm can not find a feasible solution, the least infeasible solution should be returned. By defaultFalse
.
Note, the minimize
function creates a deep copy of the algorithm object before the run. This ensures that two independent runs with the same algorithm and same random seed have the same results without any side effects. However, to access the algorithm’s internals, you can access the object being used by res.algorithm
where res
is an instance of the Result object.
API¶

pymoo.optimize.
minimize
(problem, algorithm, termination=None, copy_algorithm=True, copy_termination=True, **kwargs)¶ Minimization of function of one or more variables, objectives and constraints.
This is used as a convenience function to execute several algorithms with default settings which turned out to work for a test single. However, evolutionary computations utilizes the idea of customizing a metaalgorithm. Customizing the algorithm using the object oriented interface is recommended to improve the convergence.
 Parameters
 problem
Problem
A problem object which is defined using pymoo.
 algorithm
Algorithm
The algorithm object that should be used for the optimization.
 termination
Termination
or tuple The termination criterion that is used to stop the algorithm.
 seedinteger
The random seed to be used.
 verbosebool
Whether output should be printed or not.
 display
Display
Each algorithm has a default display object for printouts. However, it can be overwritten if desired.
 callback
Callback
A callback object which is called each iteration of the algorithm.
 save_historybool
Whether the history should be stored or not.
 copy_algorithmbool
Whether the algorithm object should be copied before optimization.
 problem
 Returns
 res
Result
The optimization result represented as an object.
 res