-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgenerate_model_size_report.py
37 lines (33 loc) · 1.1 KB
/
generate_model_size_report.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
from datetime import datetime
from importlib import import_module
from pyomo.util.model_size import build_model_size_report
import pandas as pd
if __name__ == "__main__":
instance_list = [
# "batch_processing",
# "biofuel",
# "disease_model",
# "gdp_col",
# "hda",
"jobshop",
# "kaibel",
# "logical",
# "med_term_purchasing",
# "methanol",
# "mod_hens",
# "modprodnet",
# "stranded_gas",
# "syngas",
# "water_network"
]
current_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
timelimit = 600
for instance in instance_list:
print("Generating model size report: " + instance)
model = import_module("gdplib." + instance).build_model()
report = build_model_size_report(model)
report_df = pd.DataFrame(report.overall, index=[0]).T
report_df.index.name = "Component"
report_df.columns = ["Number"]
# Generate the model size report (Markdown)
report_df.to_markdown("gdplib/" + instance + "/" + "model_size_report.md")