Skip to content

Commit

Permalink
prepare multiprocess tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
thefriedbee committed Mar 27, 2024
1 parent b671267 commit 9b34339
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions carpoolsim/prepare_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,17 @@ def build_network(self):
# print(network_dict['DG']['65666']['1'])
self.network_dict = network_dict

def prepare_taz_lists(self):
def prepare_taz_lists(self, chuck_size=100):
# break taz list to chunks for multiprocessing

pass
taz_lst = []
L = len(self.tazs_ids)
num_chucks = int(len(self.tazs_ids) / chuck_size) + 1
for idx in range(num_chucks):
start_index = idx * chuck_size
end_index = min((idx + 1) * chuck_size, L) + 1
_lst = self.tazs_ids[start_index: end_index]
taz_lst.append(_lst)
return taz_lst

def run_batch(self, source_id=1):
network_dict = self.network_dict
Expand Down

0 comments on commit 9b34339

Please sign in to comment.