SciPy Optimize

class glompo.optimizers.scipy.ScipyOptimizeWrapper(_opt_id: int = None, _signal_pipe: multiprocessing.connection.Connection = None, _results_queue: queue.Queue = None, _pause_flag: multiprocessing.context.BaseContext.Event = None, workers: int = 1, backend: str = 'processes', is_log_detailed: bool = False, method: str = 'Nelder-Mead')[source]

Bases: glompo.optimizers.baseoptimizer.BaseOptimizer

Wrapper around scipy.optimize.minimize(), scipy.optimize.basinhopping(), scipy.optimize.differential_evolution(), scipy.optimize.shgo(), and scipy.optimize.dual_annealing().

Warning

This is quite a rough wrapper around SciPy’s optimizers since the code is quite impenetrable to outside code, and callbacks do not function consistently. Therefore, most GloMPO functionality like checkpointing and information sharing is not available. Users are advised to try Nevergrad instead which offers an interface to the SciPy optimizers with full GloMPO functionality.

Attention

Must be used with GloMPOManager.aggressive_kill as True, this also implies that this optimizer can only be used with a multiprocessing backend; threads are incompatible.

Parameters:
  • _opt_id _signal_pipe _results_queue _pause_flag workers backend is_log_detailed (Inherited,) – See BaseOptimizer.
  • method – Accepts 'basinhopping', 'dual_annealing', 'differential_evolution', and 'shgo' which will run the scipy.optimize function of the same name. Also accepts all the allowed methods to scipy.optimize.minimize().
minimize(function: Callable[Sequence[float], float], x0: Sequence[float], bounds: Sequence[Tuple[float, float]], callbacks: Callable = None, **kwargs) → glompo.optimizers.baseoptimizer.MinimizeResult[source]

Run the optimization algorithm to minimize a function.

Parameters:
  • function – Function to be minimised. See BaseFunction for an API guide.
  • x0 – The initial optimizer starting point.
  • bounds – Min/max boundary limit pairs for each element of the input vector to the minimisation function.
  • callbacks – Code snippets usually called once per iteration that are able to signal early termination. Callbacks are leveraged differently by different optimizer implementations, the user is encouraged to consult the child classes for more details. Use of callbacks, however, is strongly discouraged.