def objective_func(x, rate_mask, lb, ub):

    caller_frame, _, _, caller_func, _, _ = inspect.stack()[1]
    if caller_func in {'anneal', '_minimize_anneal'}:
        caller_locals = caller_frame.f_locals
        if caller_locals['n'] == 1:
            print(caller_locals['best_state'].cost, caller_locals['current_state'].cost)