This paste expires on 2023-08-14 16:21:56.191994. Repaste, or download this paste. . Pasted through web.

import numpy as np
import dlib
def minimizer_monitor(func):
     current_opt = np.inf
     def wrapped(*args, **kwargs):
         nonlocal current_opt
         result = func(*args, **kwargs)
         if result < current_opt:
             current_opt = result
             print(f"New min: {result}\t{args=}\t{kwargs=}")
         return result
     return wrapped
@minimizer_monitor
def rosen_f(*x):
     return rosen((x))
x0 = np.ones(5)*0.25
res = dlib.find_min_global(rosen_f, [0]*5, [0.5]*5, 100)
Filename: None. Size: 524b. View raw, , hex, or download this file.