Minimize

Contents

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 default False.

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)[source]#

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 case. However, evolutionary computations utilize the idea of customizing a meta-algorithm. Customizing the algorithm using the object-oriented interface is recommended to improve convergence.

Parameters:
  • problem – A problem object which is defined using pymoo.

  • algorithm – The algorithm object that should be used for the optimization.

  • termination – The termination criterion that is used to stop the algorithm.

  • copy_algorithm – Whether the algorithm object should be copied before optimization.

  • copy_termination – Whether the termination object should be copied.

  • **kwargs – Additional arguments passed to algorithm.setup(), such as seed, verbose, display, callback, save_history.

Returns:

The optimization result represented as an object.