-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.py
60 lines (45 loc) · 1.09 KB
/
util.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
# %%
import os
import pandas as pd
from enum import Enum
EXP_PATH = os.path.abspath(os.path.join(
os.path.abspath(__file__),
os.pardir,
'experiment'
))
DATA_PATH = os.path.abspath(os.path.join(
os.path.abspath(__file__),
os.pardir,
'data'
))
FIG_PATH = os.path.abspath(os.path.join(
os.path.abspath(__file__),
os.pardir,
'figures'
))
RESULT_PATH = os.path.abspath(os.path.join(
os.path.abspath(__file__),
os.pardir,
'results'
))
PATH_PREFIX = 'MoDRL_'
def to_range(l):
return range(len(l))
def getSupplierAADistance(
distance_info_path,
supplier_info_path,
):
# supplier: AA distance
distance = pd.read_csv(distance_info_path, index_col=0)
supplier = pd.read_csv(supplier_info_path)
suppliers = supplier['Suppliers'].tolist()
all_dists = [[] for _ in to_range(suppliers)]
for i in to_range(suppliers):
sup_name = suppliers[i]
sup_dists = distance[sup_name]
all_dists[i] = sup_dists.tolist()
return all_dists
class OptimizationMethod(Enum):
WEIGHTED_SUM = 1
LP_METRIC = 2
# %%