-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.py
67 lines (52 loc) · 1.66 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import argparse
import logging
import pathlib
import time
import gin
from bounce.bounce import Bounce
from bounce.util.data_loading import (
download_uci_data,
download_maxsat60_data,
download_maxsat125_data,
)
from bounce.util.printing import BColors, BOUNCE_NAME
if __name__ == "__main__":
logging.basicConfig(
level=logging.INFO,
format=f"{BColors.LIGHTGREY} %(levelname)s:%(asctime)s - (%(filename)s:%(lineno)d) - %(message)s {BColors.ENDC}",
)
logging.info(BOUNCE_NAME)
if not pathlib.Path("data/slice_localization_data.csv").exists():
download_uci_data()
if not pathlib.Path("data/maxsat/frb10-6-4.wcnf").exists():
download_maxsat60_data()
if not pathlib.Path(
"data/maxsat/cluster-expansion-IS1_5.0.5.0.0.5_softer_periodic.wcnf"
).exists():
download_maxsat125_data()
then = time.time()
parser = argparse.ArgumentParser(
prog=BOUNCE_NAME,
description="Bounce: Reliable High-Dimensional Bayesian Optimization Algorithm for Combinatorial and Mixed Spaces",
epilog="For more information, please contact the author.",
)
parser.add_argument(
"--gin-files",
type=str,
nargs="+",
default=["configs/default.gin"],
help="Path to the config file",
)
parser.add_argument(
"--gin-bindings",
type=str,
nargs="+",
default=[],
)
args = parser.parse_args()
gin.parse_config_files_and_bindings(args.gin_files, args.gin_bindings)
bounce = Bounce()
bounce.run()
gin.clear_config()
now = time.time()
logging.info(f"Total time: {now - then:.2f} seconds")