networkqit.algorithms.basinhoppingmod.BasinHoppingRunner

class BasinHoppingRunner(x0, minimizer, step_taking, accept_tests, disp=False)[source]

This class implements the core of the basinhopping algorithm.

x0ndarray

The starting coordinates.

minimizercallable

The local minimizer, with signature result = minimizer(x). The return value is an optimize.OptimizeResult object.

step_takingcallable

This function displaces the coordinates randomly. Signature should be x_new = step_taking(x). Note that x may be modified in-place.

accept_testslist of callables

Each test is passed the kwargs f_new, x_new, f_old and x_old. These tests will be used to judge whether or not to accept the step. The acceptable return values are True, False, or "force accept". If any of the tests return False then the step is rejected. If "force accept", then this will override any other tests in order to accept the step. This can be used, for example, to forcefully escape from a local minimum that basinhopping is trapped in.

dispbool, optional

Display status messages.

__init__(x0, minimizer, step_taking, accept_tests, disp=False)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(x0, minimizer, step_taking, …[, disp])

Initialize self.

one_cycle()

Do one cycle of the basinhopping algorithm

print_report(energy_trial, accept)

print a status update