Skip to content

Commit 3b59725

Browse files
dhenslejuangacostajpn--
authored
Trip Scheduling Choice -- Same Results Single Process and Multi-Process (#1005)
* single process run with * ensured schedule order when generating alternatives * trip scheduling choice test fix * scheduling choice fix with linting * trip departture choice test fix * deleted extra outputs folder * restoring deleted arc test files * deleting extra added files * more file cleanup * removing arc from CI test list * improved testing (#10) * improved testing * blacken * stable sorting * blacken * addressing review comments --------- Co-authored-by: juangacosta <juan.acosta@rsginc.com> Co-authored-by: Jeffrey Newman <jeff@driftless.xyz>
1 parent b91a64a commit 3b59725

File tree

13 files changed

+521
-381
lines changed

13 files changed

+521
-381
lines changed

activitysim/abm/models/trip_scheduling_choice.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
PreprocessorSettings,
1919
PydanticReadable,
2020
)
21+
from activitysim.core.configuration.logit import LogitComponentSettings
2122
from activitysim.core.interaction_sample_simulate import _interaction_sample_simulate
2223
from activitysim.core.skim_dataset import SkimDataset
2324
from activitysim.core.skim_dictionary import SkimDict
@@ -81,6 +82,8 @@ def generate_schedule_alternatives(tours):
8182

8283
schedules = pd.concat([no_stops, one_way, two_way], sort=True)
8384
schedules[SCHEDULE_ID] = np.arange(1, schedules.shape[0] + 1)
85+
# this sort is necessary to keep single process and multiprocess results the same!
86+
schedules.sort_values(by=["tour_id", SCHEDULE_ID], inplace=True)
8487

8588
return schedules
8689

@@ -207,9 +210,7 @@ def get_spec_for_segment(
207210
:return: array of utility equations
208211
"""
209212

210-
omnibus_spec = state.filesystem.read_model_spec(
211-
file_name=model_settings.SPECIFICATION
212-
)
213+
omnibus_spec = state.filesystem.read_model_spec(file_name=model_settings.SPEC)
213214

214215
spec = omnibus_spec[[segment]]
215216

@@ -344,21 +345,12 @@ def run_trip_scheduling_choice(
344345
return tours
345346

346347

347-
class TripSchedulingChoiceSettings(PydanticReadable, extra="forbid"):
348+
class TripSchedulingChoiceSettings(LogitComponentSettings, extra="forbid"):
348349
"""
349350
Settings for the `trip_scheduling_choice` component.
350351
"""
351352

352-
PREPROCESSOR: PreprocessorSettings | None = None
353-
"""Setting for the preprocessor."""
354-
alts_preprocessor: PreprocessorSettings | None = None
355-
"""Setting for the alternatives preprocessor."""
356-
357-
SPECIFICATION: str
358-
"""file name of specification file"""
359-
360-
compute_settings: ComputeSettings = ComputeSettings()
361-
"""Compute settings for this component."""
353+
pass
362354

363355

364356
@workflow.step
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# read cached skims (using numpy memmap) from output directory (memmap is faster than omx )
2+
read_skim_cache: False
3+
# write memmapped cached skims to output directory after reading from omx, for use in subsequent runs
4+
write_skim_cache: True
5+
6+
zone_system: 1
7+
8+
taz_skims: skims.omx
9+
10+
skim_time_periods:
11+
time_window: 1440
12+
period_minutes: 60
13+
periods: [0, 3, 5, 9, 14, 18, 24] # 3=3:00-3:59, 5=5:00-5:59, 9=9:00-9:59, 14=2:00-2:59, 18=6:00-6:59
14+
labels: ['EA', 'EA', 'AM', 'MD', 'PM', 'EV']
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
zone_system: 1
2+
3+
taz_skims: z1_taz_skims.omx
4+
5+
skim_time_periods:
6+
time_window: 1440
7+
period_minutes: 60
8+
periods: [0, 6, 11, 16, 20, 24]
9+
labels: ['EA', 'AM', 'MD', 'PM', 'EV']
3.5 MB
Binary file not shown.

0 commit comments

Comments
 (0)