Skip to content

Commit

Permalink
update for reasonable person profile generation
Browse files Browse the repository at this point in the history
  • Loading branch information
chenchenplus committed Dec 7, 2024
1 parent b60d66c commit 768aa16
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
9 changes: 7 additions & 2 deletions mosstool/trip/generator/_util/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pycityproto.city.map.v2.map_pb2 as mapv2
import pycityproto.city.person.v2.person_pb2 as personv2
import pycityproto.city.trip.v2.trip_pb2 as tripv2
import numpy as np

DIS_CAR = 1000
DIS_BIKE = 500
Expand All @@ -23,7 +24,7 @@
"HWHWH+": 1.43,
"HSOSH": 0.00,
}
BUS_SUBWAY = tripv2.TRIP_MODE_BUS_WALK
BUS_SUBWAY = tripv2.TRIP_MODE_BUS_SUBWAY_WALK
BUS = tripv2.TRIP_MODE_BUS_WALK
SUBWAY = tripv2.TRIP_MODE_SUBWAY_WALK
CAR = tripv2.TRIP_MODE_DRIVE_ONLY
Expand Down Expand Up @@ -87,7 +88,11 @@
GENDER_STATS = [1 / len(GENDERS) for _ in range(len(GENDERS))]
AGES = [i for i in range(8, 75)]
# probabilities
AGE_STATS = [1 / len(AGES) for _ in range(len(AGES))]
# mean_age: 40
# std_dev: 15
_age_pdf = [np.exp(-((age - 40) ** 2) / (2 * 15 ** 2)) for age in AGES]
# normalization
AGE_STATS = [p / sum(_age_pdf) for p in _age_pdf]
# work catg
WORK_CATGS = {"business", "industrial", "administrative"}
# education catg
Expand Down
2 changes: 1 addition & 1 deletion mosstool/trip/route/preroute.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_TYPE_MAP = {
TripMode.TRIP_MODE_DRIVE_ONLY: RouteType.ROUTE_TYPE_DRIVING,
TripMode.TRIP_MODE_TAXI: RouteType.ROUTE_TYPE_DRIVING,
TripMode.TRIP_MODE_TAXI: RouteType.ROUTE_TYPE_TAXI,
TripMode.TRIP_MODE_BIKE_WALK: RouteType.ROUTE_TYPE_WALKING,
TripMode.TRIP_MODE_BUS_WALK: RouteType.ROUTE_TYPE_BUS,
TripMode.TRIP_MODE_SUBWAY_WALK: RouteType.ROUTE_TYPE_SUBWAY,
Expand Down
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mosstool"
version = "1.0.24"
version = "1.0.25"
description = "MObility Simulation System toolbox "
authors = ["Jun Zhang <[email protected]>","Junbo Yan <[email protected]>"]
license = "MIT"
Expand Down Expand Up @@ -29,7 +29,7 @@ bs4 = "^0.0.2"
matplotlib = "^3.8.3"
generate-od = "^0.1"
path4gmns = "^0.9.8"
pycityproto = "^2.0.1"
pycityproto = "^2.0.7"

[tool.poetry.group.dev.dependencies]
pytest = "^8.1.1"
Expand Down

0 comments on commit 768aa16

Please sign in to comment.