reqreate 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. REQreate/2assign_bus_stops_zones.py +147 -0
  2. REQreate/REQreate.py +57 -0
  3. REQreate/REQreate2.py +67 -0
  4. REQreate/REQreate3.py +62 -0
  5. REQreate/REQreate4.py +62 -0
  6. REQreate/REQreate5.py +62 -0
  7. REQreate/REQreate6.py +62 -0
  8. REQreate/REQreate7.py +62 -0
  9. REQreate/REQreate8.py +62 -0
  10. REQreate/REQreate9.py +62 -0
  11. REQreate/__init__.py +8 -0
  12. REQreate/assing_bus_stops_zones.py +80 -0
  13. REQreate/cli.py +79 -0
  14. REQreate/compute_distance_matrix.py +393 -0
  15. REQreate/dynamism.py +245 -0
  16. REQreate/fixed_lines.py +889 -0
  17. REQreate/geographic_dispersion.py +500 -0
  18. REQreate/input_json.py +1213 -0
  19. REQreate/instance_class.py +129 -0
  20. REQreate/json_to_csv.py +1159 -0
  21. REQreate/logger_utils.py +99 -0
  22. REQreate/make_travel_time_matrix.py +232 -0
  23. REQreate/network_class.py +550 -0
  24. REQreate/output_files.py +131 -0
  25. REQreate/overpass_config.py +194 -0
  26. REQreate/parameters_class.py +5 -0
  27. REQreate/passenger_requests.py +1285 -0
  28. REQreate/population_density.py +170 -0
  29. REQreate/properties_synthetic_instances.py +762 -0
  30. REQreate/request_distribution_class.py +35 -0
  31. REQreate/retrieve_POIs.py +562 -0
  32. REQreate/retrieve_bus_stations.py +230 -0
  33. REQreate/retrieve_hospitals.py +86 -0
  34. REQreate/retrieve_network.py +406 -0
  35. REQreate/retrieve_schools.py +82 -0
  36. REQreate/retrieve_zones.py +147 -0
  37. REQreate/similarity.py +168 -0
  38. REQreate/spatial_distribution_class.py +57 -0
  39. REQreate/speed_info.py +117 -0
  40. REQreate/stops_locations.py +442 -0
  41. REQreate/syn_instances_literature.py +244 -0
  42. REQreate/trip_patterns_austin.py +841 -0
  43. REQreate/trip_patterns_chicago_TNP.py +1415 -0
  44. REQreate/trip_patterns_general.py +1076 -0
  45. REQreate/trip_patterns_green.py +789 -0
  46. REQreate/trip_patterns_sanfranciscobay.py +763 -0
  47. REQreate/trip_patterns_yellow.py +795 -0
  48. REQreate/uber_movement.py +857 -0
  49. REQreate/urgency.py +69 -0
  50. REQreate/webapp/__init__.py +1 -0
  51. REQreate/webapp/app.py +990 -0
  52. REQreate/webapp/attribute_library.py +525 -0
  53. REQreate/webapp/map_utils.py +180 -0
  54. reqreate-0.1.0.dist-info/METADATA +192 -0
  55. reqreate-0.1.0.dist-info/RECORD +59 -0
  56. reqreate-0.1.0.dist-info/WHEEL +5 -0
  57. reqreate-0.1.0.dist-info/entry_points.txt +2 -0
  58. reqreate-0.1.0.dist-info/licenses/LICENSE +19 -0
  59. reqreate-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,147 @@
1
+ import math
2
+ import matplotlib.pyplot as plt
3
+ import os
4
+ import osmnx as ox
5
+ import pandas as pd
6
+ import shapely
7
+ from shapely.geometry import Polygon
8
+ from shapely.geometry import Point
9
+ from pathlib import Path
10
+ # Runnable as a script from inside this directory (python 2assign_bus_stops_zones.py) as well as
11
+ # via `python -m REQreate.2assign_bus_stops_zones`; put the repository root on sys.path so the
12
+ # REQreate package resolves either way.
13
+ import os as _os, sys as _sys
14
+ _sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
15
+
16
+ from REQreate.instance_class import Instance
17
+
18
+
19
+ def assign_bus_stops_to_zones():
20
+ pass
21
+
22
+ if __name__ == '__main__':
23
+
24
+ place_name = "Chicago, Illinois"
25
+ save_dir = os.getcwd()+'/'+place_name
26
+ pickle_dir = os.path.join(save_dir, 'pickle')
27
+ network_class_file = pickle_dir+'/'+place_name+'.network.class.pkl'
28
+
29
+ network_directory = os.getcwd()+'/'+place_name
30
+
31
+ if Path(network_class_file).is_file():
32
+ inst = Instance(folder_to_network=place_name)
33
+
34
+ save_dir_csv = os.path.join(inst.save_dir, 'csv')
35
+
36
+ #zones = pd.read_csv(save_dir_csv+'/'+place_name+'.zones.csv')
37
+ #stations = pd.read_csv(save_dir_csv+'/'+place_name+'.stations.csv')
38
+
39
+ #zone1 70% requests
40
+ pt = inst.network.polygon.centroid
41
+ lon = pt.x
42
+ lat = pt.y
43
+
44
+ earth_radius = 6371009 # meters
45
+ dist_lat = 2000
46
+ dist_lon = 2000
47
+
48
+ lat = lat
49
+ lng = lon
50
+
51
+ delta_lat = (dist_lat / earth_radius) * (180 / math.pi)
52
+ delta_lng = (dist_lon / earth_radius) * (180 / math.pi) / math.cos(lat * math.pi / 180)
53
+
54
+ north = lat + delta_lat
55
+ south = lat - delta_lat
56
+ east = lng + delta_lng
57
+ west = lng - delta_lng
58
+
59
+ #north, south, east, west = ox.utils_geo.bbox_from_point(zone_center_point, distance)
60
+ polygon1 = Polygon([(west, south), (east, south), (east, north), (west, north)])
61
+
62
+ #zone2 30% requests
63
+ earth_radius = 6371009 # meters
64
+ dist_lat = 2000
65
+ dist_lon = 2000
66
+
67
+ lat = 41.767025
68
+ lng = -87.689840
69
+
70
+
71
+ delta_lat = (dist_lat / earth_radius) * (180 / math.pi)
72
+ delta_lng = (dist_lon / earth_radius) * (180 / math.pi) / math.cos(lat * math.pi / 180)
73
+
74
+ north = lat + delta_lat
75
+ south = lat - delta_lat
76
+ east = lng + delta_lng
77
+ west = lng - delta_lng
78
+
79
+ #north, south, east, west = ox.utils_geo.bbox_from_point(zone_center_point, distance)
80
+ polygon2 = Polygon([(west, south), (east, south), (east, north), (west, north)])
81
+
82
+
83
+ all_stations = []
84
+ #for indexz, zone in zones.iterrows():
85
+ stationslis = []
86
+ for index, row in inst.network.bus_stations.iterrows():
87
+
88
+ lon = inst.network.bus_stations.loc[index, 'lon']
89
+ lat = inst.network.bus_stations.loc[index, 'lat']
90
+ #polygon = shapely.wkt.loads(zone['polygon'])
91
+ print(type(polygon1))
92
+ pnt = Point(lon, lat)
93
+ if polygon1.contains(pnt):
94
+ stationslis.append(index)
95
+
96
+
97
+
98
+ stationslis2 = []
99
+ for index, row in inst.network.bus_stations.iterrows():
100
+
101
+ lon = inst.network.bus_stations.loc[index, 'lon']
102
+ lat = inst.network.bus_stations.loc[index, 'lat']
103
+ #polygon = shapely.wkt.loads(zone['polygon'])
104
+ print(type(polygon2))
105
+ pnt = Point(lon, lat)
106
+ if polygon2.contains(pnt):
107
+ stationslis2.append(index)
108
+
109
+ data = {
110
+ 'Name': ['zone70', 'zone30'],
111
+ 'stations': [stationslis, stationslis2]
112
+ }
113
+
114
+ df = pd.DataFrame(data)
115
+
116
+ df.to_csv('zones_uneven_demand.csv', index=False)
117
+
118
+ #all_stations.append(stationslis)
119
+
120
+ #zones['stations'] = all_stations
121
+
122
+ #zones = pd.DataFrame(zones)
123
+ #zones.to_csv(save_dir_csv+'/'+place_name+'.zones.csv')
124
+
125
+
126
+ '''
127
+ path_tt_file = os.path.join(save_dir_csv, place_name+'.tt.matrix.stations.csv')
128
+ pd_travel_time_matrix = pd.DataFrame()
129
+ travel_time_matrix = []
130
+ for indexs1, station1 in stations.iterrows():
131
+ print(indexs1)
132
+ d = {}
133
+ d['station_index'] = indexs1
134
+ for indexs2, station2 in stations.iterrows():
135
+ sv = str(indexs2)
136
+ if indexs2 != indexs1:
137
+ dist_uv = inst.network._return_estimated_travel_time_drive(int(station1['osmid_drive']), int(station2['osmid_drive']))
138
+ d[sv] = dist_uv
139
+ else:
140
+ d[sv] = 0
141
+ travel_time_matrix.append(d)
142
+
143
+ xt = pd.DataFrame(travel_time_matrix)
144
+ pd_travel_time_matrix = pd_travel_time_matrix.append(xt, ignore_index=True)
145
+ pd_travel_time_matrix.set_index(['station_index'], inplace=True)
146
+ pd_travel_time_matrix.to_csv(path_tt_file)
147
+ '''
REQreate/REQreate.py ADDED
@@ -0,0 +1,57 @@
1
+ # Runnable as a script from inside this directory (python REQreate.py) as well as
2
+ # via `python -m REQreate.REQreate`; put the repository root on sys.path so the
3
+ # REQreate package resolves either way.
4
+ import os as _os, sys as _sys
5
+ _sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
6
+
7
+ from REQreate.input_json import input_json
8
+ #from streamlit import caching
9
+ import os
10
+
11
+ if __name__ == '__main__':
12
+
13
+ #caching.clear_cache()
14
+
15
+ #EDIT HERE
16
+ place_name = "Maastricht, Netherlands"
17
+ inst_directory = 'examples/maastricht/' #directory to which the configuration files are saved
18
+ base_save_folder_name = 'instancesMAASTRICHT' #give a unique folder name to save the instances
19
+ #EDIT HERE
20
+
21
+ directory = os.fsencode(inst_directory)
22
+
23
+ for instance in os.listdir(directory):
24
+
25
+ instance_filename = os.fsdecode(instance)
26
+ instance_filename = instance_filename.replace("._", "")
27
+
28
+ final_list = []
29
+
30
+ if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
31
+
32
+ file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
33
+
34
+
35
+ for filex in file_list:
36
+ filex = filex.replace('_1.json', "")
37
+ filex = filex.replace('_2.json', "")
38
+ filex = filex.replace('_3.json', "")
39
+ filex = filex.replace('_4.json', "")
40
+ filex = filex.replace('_5.json', "")
41
+ filex = filex+'.json'
42
+
43
+ final_list.append(filex)
44
+
45
+ if instance_filename not in final_list:
46
+
47
+ if (instance_filename.endswith(".json")):
48
+ print(instance_filename)
49
+ #print("here")
50
+ try:
51
+ input_json(inst_directory, instance_filename, base_save_folder_name)
52
+ except FileNotFoundError:
53
+
54
+ pass
55
+ else:
56
+ print('already FOUND')
57
+
REQreate/REQreate2.py ADDED
@@ -0,0 +1,67 @@
1
+ # Runnable as a script from inside this directory (python REQreate2.py) as well as
2
+ # via `python -m REQreate.REQreate2`; put the repository root on sys.path so the
3
+ # REQreate package resolves either way.
4
+ import os as _os, sys as _sys
5
+ _sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
6
+
7
+ from REQreate.input_json import input_json
8
+ #from streamlit import caching
9
+ import os
10
+
11
+ if __name__ == '__main__':
12
+
13
+ #caching.clear_cache()
14
+
15
+ #EDIT HERE
16
+ place_name = "Chicago, Illinois"
17
+ inst_directory = '../examples/pricing_instances/'
18
+ #inst_directory = '../examples/testes/'
19
+ base_save_folder_name = 'pricing_example' #give a unique folder name to save the instances
20
+ #EDIT HERE
21
+
22
+ directory = os.fsencode(inst_directory)
23
+
24
+ #input_json(inst_directory+'/'+'Chicago,Illinois_ODBRP_7.0_8.0_300_0.0_300.0_0.0_180_1000.json')
25
+
26
+ for instance in os.listdir(directory):
27
+
28
+ instance_filename = os.fsdecode(instance)
29
+ instance_filename = instance_filename.replace("._", "")
30
+
31
+ #print(os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name)))
32
+
33
+ final_list = []
34
+
35
+ if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
36
+
37
+ file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
38
+
39
+
40
+ for filex in file_list:
41
+ filex = filex.replace('_1.json', "")
42
+ filex = filex.replace('_2.json', "")
43
+ filex = filex.replace('_3.json', "")
44
+ filex = filex.replace('_4.json', "")
45
+ filex = filex.replace('_5.json', "")
46
+ filex = filex.replace('_6.json', "")
47
+ filex = filex.replace('_7.json', "")
48
+ filex = filex.replace('_8.json', "")
49
+ filex = filex.replace('_9.json', "")
50
+ filex = filex.replace('_10.json', "")
51
+ filex = filex+'.json'
52
+
53
+ final_list.append(filex)
54
+
55
+ if instance_filename not in final_list:
56
+
57
+ if (instance_filename.endswith(".json")):
58
+ print(instance_filename)
59
+ #print("here")
60
+ try:
61
+ input_json(inst_directory, instance_filename, base_save_folder_name)
62
+ except FileNotFoundError:
63
+
64
+ pass
65
+ else:
66
+ print('already FOUND')
67
+
REQreate/REQreate3.py ADDED
@@ -0,0 +1,62 @@
1
+ # Runnable as a script from inside this directory (python REQreate3.py) as well as
2
+ # via `python -m REQreate.REQreate3`; put the repository root on sys.path so the
3
+ # REQreate package resolves either way.
4
+ import os as _os, sys as _sys
5
+ _sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
6
+
7
+ from REQreate.input_json import input_json
8
+ #from streamlit import caching
9
+ import os
10
+
11
+ if __name__ == '__main__':
12
+
13
+ #caching.clear_cache()
14
+
15
+ #EDIT HERE
16
+ place_name = "Chicago, Illinois"
17
+ inst_directory = '../examples/high_dimension_instances/concert2/'
18
+ #inst_directory = '../examples/testes/'
19
+ base_save_folder_name = 'concert2' #give a unique folder name to save the instances
20
+ #EDIT HERE
21
+
22
+ directory = os.fsencode(inst_directory)
23
+
24
+ #input_json(inst_directory+'/'+'Chicago,Illinois_ODBRP_7.0_8.0_300_0.0_300.0_0.0_180_1000.json')
25
+
26
+ for instance in os.listdir(directory):
27
+
28
+ instance_filename = os.fsdecode(instance)
29
+ instance_filename = instance_filename.replace("._", "")
30
+
31
+ #print(os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name)))
32
+
33
+ final_list = []
34
+
35
+ if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
36
+
37
+ file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
38
+
39
+
40
+ for filex in file_list:
41
+ filex = filex.replace('_1.json', "")
42
+ filex = filex.replace('_2.json', "")
43
+ filex = filex.replace('_3.json', "")
44
+ filex = filex.replace('_4.json', "")
45
+ filex = filex.replace('_5.json', "")
46
+ filex = filex+'.json'
47
+
48
+ final_list.append(filex)
49
+
50
+ if instance_filename not in final_list:
51
+
52
+ if (instance_filename.endswith(".json")):
53
+ print(instance_filename)
54
+ #print("here")
55
+ try:
56
+ input_json(inst_directory, instance_filename, base_save_folder_name)
57
+ except FileNotFoundError:
58
+
59
+ pass
60
+ else:
61
+ print('already FOUND')
62
+
REQreate/REQreate4.py ADDED
@@ -0,0 +1,62 @@
1
+ # Runnable as a script from inside this directory (python REQreate4.py) as well as
2
+ # via `python -m REQreate.REQreate4`; put the repository root on sys.path so the
3
+ # REQreate package resolves either way.
4
+ import os as _os, sys as _sys
5
+ _sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
6
+
7
+ from REQreate.input_json import input_json
8
+ #from streamlit import caching
9
+ import os
10
+
11
+ if __name__ == '__main__':
12
+
13
+ #caching.clear_cache()
14
+
15
+ #EDIT HERE
16
+ place_name = "Chicago, Illinois"
17
+ inst_directory = '../examples/high_dimension_instances/festival/'
18
+ #inst_directory = '../examples/testes/'
19
+ base_save_folder_name = 'festival' #give a unique folder name to save the instances
20
+ #EDIT HERE
21
+
22
+ directory = os.fsencode(inst_directory)
23
+
24
+ #input_json(inst_directory+'/'+'Chicago,Illinois_ODBRP_7.0_8.0_300_0.0_300.0_0.0_180_1000.json')
25
+
26
+ for instance in os.listdir(directory):
27
+
28
+ instance_filename = os.fsdecode(instance)
29
+ instance_filename = instance_filename.replace("._", "")
30
+
31
+ #print(os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name)))
32
+
33
+ final_list = []
34
+
35
+ if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
36
+
37
+ file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
38
+
39
+
40
+ for filex in file_list:
41
+ filex = filex.replace('_1.json', "")
42
+ filex = filex.replace('_2.json', "")
43
+ filex = filex.replace('_3.json', "")
44
+ filex = filex.replace('_4.json', "")
45
+ filex = filex.replace('_5.json', "")
46
+ filex = filex+'.json'
47
+
48
+ final_list.append(filex)
49
+
50
+ if instance_filename not in final_list:
51
+
52
+ if (instance_filename.endswith(".json")):
53
+ print(instance_filename)
54
+ #print("here")
55
+ try:
56
+ input_json(inst_directory, instance_filename, base_save_folder_name)
57
+ except FileNotFoundError:
58
+
59
+ pass
60
+ else:
61
+ print('already FOUND')
62
+
REQreate/REQreate5.py ADDED
@@ -0,0 +1,62 @@
1
+ # Runnable as a script from inside this directory (python REQreate5.py) as well as
2
+ # via `python -m REQreate.REQreate5`; put the repository root on sys.path so the
3
+ # REQreate package resolves either way.
4
+ import os as _os, sys as _sys
5
+ _sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
6
+
7
+ from REQreate.input_json import input_json
8
+ #from streamlit import caching
9
+ import os
10
+
11
+ if __name__ == '__main__':
12
+
13
+ #caching.clear_cache()
14
+
15
+ #EDIT HERE
16
+ place_name = "Chicago, Illinois"
17
+ inst_directory = '../examples/ODBRP_benchmark_configuration_files/3000_1000_3000/'
18
+ #inst_directory = '../examples/testes/'
19
+ base_save_folder_name = '3000_1000_3000' #give a unique folder name to save the instances
20
+ #EDIT HERE
21
+
22
+ directory = os.fsencode(inst_directory)
23
+
24
+ #input_json(inst_directory+'/'+'Chicago,Illinois_ODBRP_7.0_8.0_300_0.0_300.0_0.0_180_1000.json')
25
+
26
+ for instance in os.listdir(directory):
27
+
28
+ instance_filename = os.fsdecode(instance)
29
+ instance_filename = instance_filename.replace("._", "")
30
+
31
+ #print(os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name)))
32
+
33
+ final_list = []
34
+
35
+ if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
36
+
37
+ file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
38
+
39
+
40
+ for filex in file_list:
41
+ filex = filex.replace('_1.json', "")
42
+ filex = filex.replace('_2.json', "")
43
+ filex = filex.replace('_3.json', "")
44
+ filex = filex.replace('_4.json', "")
45
+ filex = filex.replace('_5.json', "")
46
+ filex = filex+'.json'
47
+
48
+ final_list.append(filex)
49
+
50
+ if instance_filename not in final_list:
51
+
52
+ if (instance_filename.endswith(".json")):
53
+ print(instance_filename)
54
+ #print("here")
55
+ try:
56
+ input_json(inst_directory, instance_filename, base_save_folder_name)
57
+ except FileNotFoundError:
58
+
59
+ pass
60
+ else:
61
+ print('already FOUND')
62
+
REQreate/REQreate6.py ADDED
@@ -0,0 +1,62 @@
1
+ # Runnable as a script from inside this directory (python REQreate6.py) as well as
2
+ # via `python -m REQreate.REQreate6`; put the repository root on sys.path so the
3
+ # REQreate package resolves either way.
4
+ import os as _os, sys as _sys
5
+ _sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
6
+
7
+ from REQreate.input_json import input_json
8
+ #from streamlit import caching
9
+ import os
10
+
11
+ if __name__ == '__main__':
12
+
13
+ #caching.clear_cache()
14
+
15
+ #EDIT HERE
16
+ place_name = "Chicago, Illinois"
17
+ inst_directory = '../examples/ODBRP_benchmark_configuration_files/3000_3000_6000/'
18
+ #inst_directory = '../examples/testes/'
19
+ base_save_folder_name = '3000_3000_6000' #give a unique folder name to save the instances
20
+ #EDIT HERE
21
+
22
+ directory = os.fsencode(inst_directory)
23
+
24
+ #input_json(inst_directory+'/'+'Chicago,Illinois_ODBRP_7.0_8.0_300_0.0_300.0_0.0_180_1000.json')
25
+
26
+ for instance in os.listdir(directory):
27
+
28
+ instance_filename = os.fsdecode(instance)
29
+ instance_filename = instance_filename.replace("._", "")
30
+
31
+ #print(os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name)))
32
+
33
+ final_list = []
34
+
35
+ if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
36
+
37
+ file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
38
+
39
+
40
+ for filex in file_list:
41
+ filex = filex.replace('_1.json', "")
42
+ filex = filex.replace('_2.json', "")
43
+ filex = filex.replace('_3.json', "")
44
+ filex = filex.replace('_4.json', "")
45
+ filex = filex.replace('_5.json', "")
46
+ filex = filex+'.json'
47
+
48
+ final_list.append(filex)
49
+
50
+ if instance_filename not in final_list:
51
+
52
+ if (instance_filename.endswith(".json")):
53
+ print(instance_filename)
54
+ #print("here")
55
+ try:
56
+ input_json(inst_directory, instance_filename, base_save_folder_name)
57
+ except FileNotFoundError:
58
+
59
+ pass
60
+ else:
61
+ print('already FOUND')
62
+
REQreate/REQreate7.py ADDED
@@ -0,0 +1,62 @@
1
+ # Runnable as a script from inside this directory (python REQreate7.py) as well as
2
+ # via `python -m REQreate.REQreate7`; put the repository root on sys.path so the
3
+ # REQreate package resolves either way.
4
+ import os as _os, sys as _sys
5
+ _sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
6
+
7
+ from REQreate.input_json import input_json
8
+ #from streamlit import caching
9
+ import os
10
+
11
+ if __name__ == '__main__':
12
+
13
+ #caching.clear_cache()
14
+
15
+ #EDIT HERE
16
+ place_name = "Chicago, Illinois"
17
+ inst_directory = '../examples/ODBRP_benchmark_configuration_files/2100_180_1000/'
18
+ #inst_directory = '../examples/testes/'
19
+ base_save_folder_name = '2100_180_1000' #give a unique folder name to save the instances
20
+ #EDIT HERE
21
+
22
+ directory = os.fsencode(inst_directory)
23
+
24
+ #input_json(inst_directory+'/'+'Chicago,Illinois_ODBRP_7.0_8.0_300_0.0_300.0_0.0_180_1000.json')
25
+
26
+ for instance in os.listdir(directory):
27
+
28
+ instance_filename = os.fsdecode(instance)
29
+ instance_filename = instance_filename.replace("._", "")
30
+
31
+ #print(os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name)))
32
+
33
+ final_list = []
34
+
35
+ if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
36
+
37
+ file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
38
+
39
+
40
+ for filex in file_list:
41
+ filex = filex.replace('_1.json', "")
42
+ filex = filex.replace('_2.json', "")
43
+ filex = filex.replace('_3.json', "")
44
+ filex = filex.replace('_4.json', "")
45
+ filex = filex.replace('_5.json', "")
46
+ filex = filex+'.json'
47
+
48
+ final_list.append(filex)
49
+
50
+ if instance_filename not in final_list:
51
+
52
+ if (instance_filename.endswith(".json")):
53
+ print(instance_filename)
54
+ #print("here")
55
+ try:
56
+ input_json(inst_directory, instance_filename, base_save_folder_name)
57
+ except FileNotFoundError:
58
+
59
+ pass
60
+ else:
61
+ print('already FOUND')
62
+
REQreate/REQreate8.py ADDED
@@ -0,0 +1,62 @@
1
+ # Runnable as a script from inside this directory (python REQreate8.py) as well as
2
+ # via `python -m REQreate.REQreate8`; put the repository root on sys.path so the
3
+ # REQreate package resolves either way.
4
+ import os as _os, sys as _sys
5
+ _sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
6
+
7
+ from REQreate.input_json import input_json
8
+ #from streamlit import caching
9
+ import os
10
+
11
+ if __name__ == '__main__':
12
+
13
+ #caching.clear_cache()
14
+
15
+ #EDIT HERE
16
+ place_name = "Chicago, Illinois"
17
+ inst_directory = '../examples/ODBRP_benchmark_configuration_files/2100_1000_3000/'
18
+ #inst_directory = '../examples/testes/'
19
+ base_save_folder_name = '2100_1000_3000' #give a unique folder name to save the instances
20
+ #EDIT HERE
21
+
22
+ directory = os.fsencode(inst_directory)
23
+
24
+ #input_json(inst_directory+'/'+'Chicago,Illinois_ODBRP_7.0_8.0_300_0.0_300.0_0.0_180_1000.json')
25
+
26
+ for instance in os.listdir(directory):
27
+
28
+ instance_filename = os.fsdecode(instance)
29
+ instance_filename = instance_filename.replace("._", "")
30
+
31
+ #print(os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name)))
32
+
33
+ final_list = []
34
+
35
+ if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
36
+
37
+ file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
38
+
39
+
40
+ for filex in file_list:
41
+ filex = filex.replace('_1.json', "")
42
+ filex = filex.replace('_2.json', "")
43
+ filex = filex.replace('_3.json', "")
44
+ filex = filex.replace('_4.json', "")
45
+ filex = filex.replace('_5.json', "")
46
+ filex = filex+'.json'
47
+
48
+ final_list.append(filex)
49
+
50
+ if instance_filename not in final_list:
51
+
52
+ if (instance_filename.endswith(".json")):
53
+ print(instance_filename)
54
+ #print("here")
55
+ try:
56
+ input_json(inst_directory, instance_filename, base_save_folder_name)
57
+ except FileNotFoundError:
58
+
59
+ pass
60
+ else:
61
+ print('already FOUND')
62
+