def METHOD_NAME(self, n_iter: int):
    for params in self.hyperparameters(n_iter):
        configs = dict(zip(self.param_names, params))
        self.print_params(configs)
        configs.update(self.fixed_params)
        log_dir = self.get_log_dir(params)
        if is_main_process():
            with log_dir.joinpath("configs.json").open("w") as f:
                json.dump(configs, f, indent=4)
        configs["cuda_device"] = self.cuda_device
        configs["log_dir"] = log_dir
        try:
            exp_info = self.run_training(configs)
        except Exception as e:
            print(
                f"Current config has problem:\n{textwrap.indent(traceback.format_exc(), ' '*4)}skipped."
            )
            continue
        self.update_record(params, **exp_info)
    if is_main_process():
        exp_dir = self.get_optimal_model()
        test_info = self.run_test(exp_dir)
    else:
        test_info = None
    synchronize()
    return test_info