forked from MxHbm/Management-Science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
44 lines (30 loc) · 1.22 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
''' main.py '''
#### Import python scrips
from model import * #Gurobi Modell
from results import * #Ergebnisse
import logging
def main():
#initialize logging
logger = logging.getLogger('Model_Log')
logger.setLevel(logging.INFO)
fh = logging.FileHandler('results/logging.log')
fh.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
logger.addHandler(fh)
logger.info('========================================= Start logging ========================================= ')
# Model Class Object!
m = Model()
data = Parameters("data/base_data.json")
try:
gp_model, logger = m.Run_Model(data, logger)
# Run detailed model without logger so far!!
gp_model_detailed, logger = m.Run_Detailed_Model(data,gp_model, logger)
#results = Results(gp_model, data)
#results.Evaluate_results()
# gp_model_detailed.printAttr('X')
except Exception as e:
logger.exception(e)
logger.info('========================================= End logging =========================================== \n')
if __name__ == "__main__":
main()