def main(unused): ## change config = BasicConfig().load(unused[1]) config.to_flags(FLAGS) ## val = rosenbrock(FLAGS.x, FLAGS.y) print_result(val)
def run(expdir): start_time = time.time() expdir_monitor = ExpdirMonitor(expdir) valid_performance = expdir_monitor.run(pure=True, restore=False) end_time = time.time() print('running time: %s' % (end_time - start_time)) print('valid performance: %s' % valid_performance) print_result(valid_performance)
#!/usr/bin/env python3 """ Job will fail when sleep time is 1 ============================================ .. Copyright (c) 2018 LG Electronics Inc. SPDX-License-Identifier: GPL-3.0-or-later """ import sys from time import sleep from aup import BasicConfig, print_result if __name__ == "__main__": if len(sys.argv) != 2: print("config file required") exit(1) config = BasicConfig().load(sys.argv[1]) sleep(1 + config.time / 10.) if config.time == 3: exit(1) print_result(config.time)
#!/usr/bin/env python """ Modified Rosenbrock function for HPO and aup ============================================ .. Copyright (c) 2018 LG Electronics Inc. SPDX-License-Identifier: GPL-3.0-or-later """ import sys from aup import BasicConfig, print_result def rosenbrock(conf, a=1, b=100): x = conf.x y = conf.y return (a - x) * (a - x) + b * (y - x * x) * (y - x * x) if __name__ == "__main__": if len(sys.argv) != 2: print("config file required") exit(1) config = BasicConfig().load(sys.argv[1]) val = rosenbrock(config) print_result(val)
def aup_wrapper(config): res = func(x=config['x']) print_result(res)