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 which defines 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 ensure 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 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: 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 default False.
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 algorithm’s internals you can access the object being used by
res is an instance of the Result object.
minimize(problem, algorithm, termination=None, **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 meta-algorithm. Customizing the algorithm using the object oriented interface is recommended to improve the convergence.
A problem object which is defined using pymoo.
The algorithm object that should be used for the optimization.
The termination criterion that is used to stop the algorithm.
The random seed to be used.
Whether output should be printed or not.
Each algorithm has a default display object for printouts. However, it can be overwritten if desired.
A callback object which is called each iteration of the algorithm.
Whether the history should be stored or not.
The optimization result represented as an object.