-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot_BCG.py
More file actions
79 lines (65 loc) · 2.15 KB
/
Copy pathplot_BCG.py
File metadata and controls
79 lines (65 loc) · 2.15 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
"""
Reproduce all figures for the Batch Column Generation (B-CG) analysis.
Benchmark results must already exist under Outputs/Phase_2/.
Usage
-----
python scripts/plot_BCG.py # all folders
python scripts/plot_BCG.py --folders ablation # one folder
python scripts/plot_BCG.py --folders ablation multiObj # several
python scripts/plot_BCG.py --folders all # explicit all
python scripts/plot_BCG.py --gather-data # merge before plotting
Available folders
-----------------
nbPicks, pruning, truncate, dropPick, dynamic, commit,
ablation, multiObj, customer_weight, compare, obj_compare
"""
import sys
import os
import argparse
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import batch_CG_postprocess as postprocess
import constants as c
DEFAULT_PHASE = "Phase_2"
DEFAULT_FOLDERS = "all"
AVAILABLE_FOLDERS = list(c.FOLDERS.get(DEFAULT_PHASE, {}).keys())
def main():
parser = argparse.ArgumentParser(
description="Reproduce B-CG figures from pre-computed benchmark results.",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=__doc__,
)
parser.add_argument(
"--phase",
default=DEFAULT_PHASE,
help=f"Results phase directory (default: {DEFAULT_PHASE}).",
)
parser.add_argument(
"--folders",
nargs="+",
default=[DEFAULT_FOLDERS],
metavar="FOLDER",
help=(
f"Folder key(s) to plot, or 'all'. "
f"Available: {', '.join(AVAILABLE_FOLDERS)}. "
f"(default: {DEFAULT_FOLDERS})"
),
)
parser.add_argument(
"--gather-data",
action="store_true",
help="Merge epoch results before plotting.",
)
args = parser.parse_args()
selected = args.folders
if len(selected) == 1 and selected[0] == "all":
selected = "all"
elif len(selected) == 1:
selected = selected[0]
postprocess.main(
name="",
phase=args.phase,
selected_folders=selected,
gather_data=args.gather_data,
)
if __name__ == "__main__":
main()