Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

School Escorting #574

Merged
merged 62 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
da13d63
school escorting initial commit
dhensle Jun 11, 2022
bd9e4bf
bundles created
dhensle Jun 21, 2022
9dc3190
added pure escort tours after non_mand_sched
dhensle Jun 23, 2022
23f26e3
created escorting tours & trips
dhensle Jul 29, 2022
93ee763
integrated escort tours and trips
dhensle Aug 2, 2022
c82db36
downstream model integration
dhensle Aug 8, 2022
194c3dd
nm tour scheduling passing
dhensle Aug 14, 2022
f659405
updating stop freq in tours table
dhensle Aug 14, 2022
fe2ee40
added check for mand tour overlap with pe tours
dhensle Aug 14, 2022
e9ea02b
num chauffeurs and escortees
dhensle Aug 14, 2022
0407108
merging canonical ids from flexible id work
dhensle Aug 14, 2022
8c0d2a0
setting escorting tour and trip ids
dhensle Aug 15, 2022
b49e97c
remove unneeded nmtf settings file
dhensle Aug 15, 2022
c6ce7bd
black formatting
dhensle Aug 15, 2022
25631e8
excluding escort trips from trip scheduling
dhensle Aug 15, 2022
14ccd97
fixing bug where mand tours not getting assigned correct id
dhensle Aug 15, 2022
23734a0
adding school_escorting to mp model list
dhensle Aug 15, 2022
d7bd408
adding school escort tour flavors as own category
dhensle Aug 16, 2022
6691c9b
updating timetable windows with pure escort tours
dhensle Aug 16, 2022
0b1d3c5
additional logging
dhensle Aug 16, 2022
01c84ae
adding non-mand destination changes
dhensle Aug 16, 2022
1a60a9f
fixing bad tdd merge
dhensle Aug 16, 2022
1df6927
merging tdd alts to all tours
dhensle Aug 17, 2022
c3f942e
adding ride share threshold to unvailability for pure escort time ove…
dhensle Aug 18, 2022
7c9fe32
cleanup
dhensle Aug 18, 2022
f7d9d29
mins per time bin
dhensle Aug 18, 2022
f84d7bd
black formatting
dhensle Aug 18, 2022
be63890
merge with develop
dhensle Aug 18, 2022
9c76c17
black formatting
dhensle Aug 18, 2022
28e96c8
fixing reindex import bug
dhensle Aug 18, 2022
1b4203a
fixing missed import
dhensle Aug 19, 2022
6f855f3
replacing trips test table
dhensle Aug 19, 2022
3ee29ec
inserting default setting if no models in config for tests
dhensle Aug 19, 2022
e78a4ec
adding setup function to tests to set configs_dir injectable
dhensle Aug 19, 2022
3ea0f4b
documentation
dhensle Aug 19, 2022
387aaca
fixed origin bug and missing outbound trip to work
dhensle Aug 25, 2022
f8365f5
proper cleanup when trips that get removed if schedule failed
dhensle Aug 30, 2022
a526721
changed failed trip scheduling option for example
dhensle Aug 30, 2022
71f9046
updating regress table
dhensle Aug 30, 2022
ed1ccca
blacken
dhensle Aug 30, 2022
3f72e95
allowing multiple escort tours in the same period
dhensle Sep 2, 2022
af50994
sandag 3-zone example fix
dhensle Sep 5, 2022
1aee18c
fixing expression for missing escort participants sandag 3_zone
dhensle Sep 5, 2022
2a63d3a
cleanup
dhensle Sep 5, 2022
2fdf7ea
fixing bug for inbound destination for second escortee
dhensle Sep 21, 2022
c6d342b
blacken
dhensle Sep 21, 2022
48085bb
review responses
dhensle Dec 2, 2022
6da35a6
escortee modes match chauf modes
dhensle Dec 23, 2022
a568076
merging in develop branch
dhensle Dec 23, 2022
b787859
updating regression tests
dhensle Dec 23, 2022
9c4d96f
fixing bad var name in inbound expressions
dhensle Dec 23, 2022
838d80d
Merge branch 'develop' into school_escorting
jpn-- Jan 3, 2023
ff5f57d
Update school_escorting.yaml
jpn-- Jan 3, 2023
df2f38a
Update config.py
jpn-- Jan 3, 2023
80d8a53
require sharrow 2.5
jpn-- Jan 9, 2023
684cc9c
fix mtc_ext for sharrow
jpn-- Jan 10, 2023
6bb3660
fix test consistent with escort mode alignments
jpn-- Jan 10, 2023
5063070
allow sharrow skipping
jpn-- Jan 12, 2023
88b0847
remove stray indent
jpn-- Jan 12, 2023
30af6ba
delete expression values after sharrow testing to make debugging easier
jpn-- Jan 12, 2023
28480b0
require sharrow 2.5.2
jpn-- Jan 12, 2023
d3dd6ac
note on sharrow_skip
jpn-- Jan 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions activitysim/abm/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
non_mandatory_scheduling,
non_mandatory_tour_frequency,
parking_location_choice,
school_escorting,
stop_frequency,
summarize,
telecommute_frequency,
Expand Down
29 changes: 27 additions & 2 deletions activitysim/abm/models/non_mandatory_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from activitysim.core import config, inject, pipeline, simulate, tracing
from activitysim.core.util import assign_in_place

from .util import estimation, tour_destination
from .util import estimation, tour_destination, annotate


logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -43,7 +44,18 @@ def non_mandatory_tour_destination(
# choosers are tours - in a sense tours are choosing their destination
non_mandatory_tours = tours[tours.tour_category == "non_mandatory"]

# - if no mandatory_tours
# separating out pure escort school tours
# they already have their destination set
if pipeline.is_table("school_escort_tours"):
nm_tour_index = non_mandatory_tours.index
pure_school_escort_tours = non_mandatory_tours[
(non_mandatory_tours["school_esc_outbound"] == "pure_escort")
| (non_mandatory_tours["school_esc_inbound"] == "pure_escort")
]
non_mandatory_tours = non_mandatory_tours[
~non_mandatory_tours.index.isin(pure_school_escort_tours.index)
]

if non_mandatory_tours.shape[0] == 0:
tracing.no_results(trace_label)
return
Expand Down Expand Up @@ -85,14 +97,27 @@ def non_mandatory_tour_destination(

non_mandatory_tours["destination"] = choices_df.choice

# merging back in school escort tours and preserving index
if pipeline.is_table("school_escort_tours"):
non_mandatory_tours = pd.concat(
[pure_school_escort_tours, non_mandatory_tours]
).set_index(nm_tour_index)

assign_in_place(tours, non_mandatory_tours[["destination"]])

if want_logsums:
non_mandatory_tours[logsum_column_name] = choices_df["logsum"]
assign_in_place(tours, non_mandatory_tours[[logsum_column_name]])

assert all(
~tours["destination"].isna()
), f"Tours are missing destination: {tours[tours['destination'].isna()]}"

pipeline.replace_table("tours", tours)

if model_settings.get("annotate_tours"):
annotate.annotate_tours(model_settings, trace_label)

if want_sample_table:
assert len(save_sample_df.index.get_level_values(0).unique()) == len(choices_df)
# save_sample_df.set_index(model_settings['ALT_DEST_COL_NAME'], append=True, inplace=True)
Expand Down
3 changes: 0 additions & 3 deletions activitysim/abm/models/non_mandatory_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
from activitysim.core import timetable as tt
from activitysim.core import tracing
from activitysim.core.util import assign_in_place

from .util import estimation
from .util.tour_scheduling import run_tour_scheduling
from .util.vectorize_tour_scheduling import vectorize_tour_scheduling

logger = logging.getLogger(__name__)
DUMP = False
Expand Down
10 changes: 10 additions & 0 deletions activitysim/abm/models/non_mandatory_tour_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from activitysim.core.interaction_simulate import interaction_simulate

from .util import estimation
from .util import annotate
from .util.school_escort_tours_trips import recompute_tour_count_statistics

from .util.overlap import person_max_window
from .util.tour_frequency import process_non_mandatory_tours

Expand Down Expand Up @@ -376,6 +379,13 @@ def non_mandatory_tour_frequency(persons, persons_merged, chunk_size, trace_hh_i
tracing.register_traceable_table("tours", non_mandatory_tours)
pipeline.get_rn_generator().add_channel("tours", non_mandatory_tours)

if pipeline.is_table("school_escort_tours"):
# need to re-compute tour frequency statistics to account for school escort tours
recompute_tour_count_statistics()

if model_settings.get("annotate_tours"):
annotate.annotate_tours(model_settings, trace_label)

expressions.assign_columns(
df=persons,
model_settings=model_settings.get("annotate_persons"),
Expand Down
Loading