Skip to content

Commit 10811d7

Browse files
committed
cosmetic changes in quotes
- use single quotes consistently; - include perform_network_assignment in __all__ of colgen.py.
1 parent 98d0b60 commit 10811d7

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

path4gmns/classes.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def setup_agents(self, column_pool):
415415
# agent.agent_seq_no = i
416416

417417
self.agent_size = len(self.agent_list)
418-
print(f"the number of agents is {self.agent_size}")
418+
print(f'the number of agents is {self.agent_size}')
419419

420420
def _get_agent(self, agent_no):
421421
""" retrieve agent using agent_no """
@@ -848,7 +848,7 @@ def get_node_no(self, node_id):
848848
try:
849849
return self.node_id_to_no[node_id]
850850
except KeyError:
851-
raise(f"EXCEPTION: Node ID {node_id} NOT IN THE NETWORK!!")
851+
raise(f'EXCEPTION: Node ID {node_id} NOT IN THE NETWORK!!')
852852

853853
def get_agent_type(self):
854854
return self.agent_type
@@ -1028,7 +1028,6 @@ def set_target_mode(self, mode):
10281028
----------
10291029
mode : agent name which is in settings.yml.
10301030
"""
1031-
# assert(mode in ['p', 'w', 'b', 'a'])
10321031
self.agent_type_name = mode
10331032

10341033
def set_source_node_id(self, node_id):
@@ -1379,7 +1378,7 @@ def get_node_label_cost(self, node_no):
13791378
def get_accessible_nodes(self, source_node_id, time_budget,
13801379
mode, time_dependent, tau):
13811380
if source_node_id not in self.network.node_id_to_no_dict.keys():
1382-
raise Exception(f"Node ID: {source_node_id} not in the network")
1381+
raise Exception(f'Node ID: {source_node_id} not in the network')
13831382

13841383
assert(time_budget>=0)
13851384

path4gmns/colgen.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .consts import MIN_OD_VOL, MAX_LABEL_COST, SMALL_DIVISOR
66

77

8-
__all__ = ['perform_column_generation']
8+
__all__ = ['perform_column_generation', 'perform_network_assignment']
99

1010

1111
def _update_generalized_link_cost(spnetworks):
@@ -197,7 +197,7 @@ def _optimize_column_pool(column_pool,
197197
column_update_num):
198198

199199
for i in range(column_update_num):
200-
print(f"current iteration number in column generation: {i}")
200+
print(f'current iteration number in column generation: {i}')
201201
_update_column_gradient_cost_and_flow(column_pool,
202202
links,
203203
agent_types,
@@ -363,7 +363,7 @@ def perform_column_generation(iter_num, column_update_num, ui):
363363
st = time()
364364

365365
for i in range(iter_num):
366-
print(f"current iteration number in assignment: {i}")
366+
print(f'current iteration number in assignment: {i}')
367367
_update_link_travel_time_and_cost(links)
368368

369369
_reset_and_update_link_vol_based_on_columns(column_pool,
@@ -425,4 +425,4 @@ def perform_network_assignment(assignment_mode, iter_num, column_update_num, ui)
425425
'Please please use perform_network_assignment_DTALite().'
426426
)
427427

428-
perform_column_generation(iter_num, column_update_num, ui)
428+
perform_column_generation(iter_num, column_update_num, ui)

path4gmns/path.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ def _get_path_cost(G, to_node_id):
278278

279279
def find_shortest_path(G, from_node_id, to_node_id, seq_type='node'):
280280
if from_node_id not in G.node_id_to_no_dict.keys():
281-
raise Exception(f"Node ID: {from_node_id} not in the network")
281+
raise Exception(f'Node ID: {from_node_id} not in the network')
282282
if to_node_id not in G.node_id_to_no_dict.keys():
283-
raise Exception(f"Node ID: {to_node_id} not in the network")
283+
raise Exception(f'Node ID: {to_node_id} not in the network')
284284

285285
single_source_shortest_path(G, from_node_id, engine_type='c')
286286

@@ -320,9 +320,9 @@ def find_path_for_agents(G, column_pool, engine_type='c'):
320320
continue
321321

322322
if from_node_id not in G.node_id_to_no_dict.keys():
323-
raise Exception(f"Node ID: {from_node_id} not in the network")
323+
raise Exception(f'Node ID: {from_node_id} not in the network')
324324
if to_node_id not in G.node_id_to_no_dict.keys():
325-
raise Exception(f"Node ID: {to_node_id} not in the network")
325+
raise Exception(f'Node ID: {to_node_id} not in the network')
326326

327327
# simple caching strategy
328328
# if the current from_node_id is the same as from_node_id_prev,

path4gmns/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,14 @@ def read_nodes(input_dir,
202202

203203
node_seq_no += 1
204204

205-
print(f"the number of nodes is {node_seq_no}")
205+
print(f'the number of nodes is {node_seq_no}')
206206

207207
zone_size = len(zone_to_node_dict)
208208
# do not count virtual zone with id as -1
209209
if -1 in zone_to_node_dict.keys():
210210
zone_size -= 1
211211

212-
print(f"the number of zones is {zone_size}")
212+
print(f'the number of zones is {zone_size}')
213213

214214

215215
def read_links(input_dir,
@@ -250,8 +250,8 @@ def read_links(input_dir,
250250
from_node_no = id_to_no_dict[from_node_id]
251251
to_node_no = id_to_no_dict[to_node_id]
252252
except KeyError:
253-
print(f"EXCEPTION: Node ID {from_node_id} "
254-
f"or/and Node ID {to_node_id} NOT IN THE NETWORK!!")
253+
print(f'EXCEPTION: Node ID {from_node_id} '
254+
f'or/and Node ID {to_node_id} NOT IN THE NETWORK!!')
255255
continue
256256

257257
# for the following attributes,
@@ -407,7 +407,7 @@ def read_links(input_dir,
407407

408408
link_seq_no += 1
409409

410-
print(f"the number of links is {link_seq_no}")
410+
print(f'the number of links is {link_seq_no}')
411411

412412

413413
def read_demand(input_dir,
@@ -463,7 +463,7 @@ def read_demand(input_dir,
463463

464464
total_agents += int(volume + 1)
465465

466-
print(f"the number of agents is {total_agents}")
466+
print(f'the number of agents is {total_agents}')
467467

468468
if total_agents == 0:
469469
raise Exception('NO VALID OD VOLUME!! DOUBLE CHECK YOUR demand.csv')

0 commit comments

Comments
 (0)