-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.py
More file actions
38 lines (31 loc) · 1.07 KB
/
logger.py
File metadata and controls
38 lines (31 loc) · 1.07 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
import logging
from pathlib import Path
import multiprocessing as mp
from os import getpid
import os
from time import strftime
def setup_logger_mpc():
LOG_PATH = Path(__file__).parent/ "logs"
LOG_FILE = LOG_PATH / strftime(
"ADMM-mpc-_%m-%d-%y_%H.%M.%S_{getpid()}.csv"
)
if not LOG_PATH.is_dir():
LOG_PATH.mkdir()
print(f"Logging results to {LOG_FILE}")
logging.basicConfig(filename=LOG_FILE, format="%(message)s", level=logging.INFO)
logging.info(
"i_trial, n_agents, t, converged, obj_trj,T,dt,radius,\
SOVA_admm ,t_solve_avg, t_solve_std, MAX_ITER, dist_to_goal"
)
def setup_logger_admm():
LOG_PATH = Path(__file__).parent/ "logs"
LOG_FILE = LOG_PATH / strftime(
"ADMM-_%m-%d-%y_%H.%M.%S_{getpid()}.csv"
)
if not LOG_PATH.is_dir():
LOG_PATH.mkdir()
print(f"Logging results to {LOG_FILE}")
logging.basicConfig(filename=LOG_FILE, format="%(message)s", level=logging.INFO)
logging.info(
"solver,n_trial,mean_times,std_times,n_agents,mpc_iter,obj_val"
)