Skip to content

Commit

Permalink
add random aoi position choice for TripGenerator.fill_person_schedules
Browse files Browse the repository at this point in the history
  • Loading branch information
chenchenplus committed Sep 23, 2024
1 parent 98cba72 commit 0604c9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions mosstool/trip/generator/generate_from_od.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,17 @@ def _generate_schedules(self, input_persons: List[Person], seed: int):
for idx, p in enumerate(orig_persons):
try:
p_home = p.home.aoi_position.aoi_id
if not p_home >= AOI_START_ID:
logging.warning(
f"Person {p.id} has no home AOI ID, use random home instead!"
)
p_home = rng.choice(self.aoi_type2ids["home"])
p_work = p.work.aoi_position.aoi_id
if not p_work >= AOI_START_ID:
logging.warning(
f"Person {p.id} has no work AOI ID, use random work instead!"
)
p_work = rng.choice(self.aoi_type2ids["other"])
p_profile = pb2dict(p.profile)
person_args.append(
[
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mosstool"
version = "0.2.38"
version = "0.2.39"
description = "MObility Simulation System toolbox "
authors = ["Jun Zhang <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 0604c9a

Please sign in to comment.