Skip to content

Commit

Permalink
Trip Scheduling Bug & Trip Mode Choice Annotate (#55)
Browse files Browse the repository at this point in the history
* other sp methods price updates

* Trip Scheduling into Resident Debug (#54)

* Differentiate examples between quality and validity of example models (ActivitySim#571)

* change examples that are no longer tied to an agency to fictional place names

* change name of full example also

* add back missing output dir

* restore test output dir also

* more empty dirs that got lost

* clean up docs

* example_mtc -> prototype_mtc

* Prototype MTC extended

* add all the ignored files

* add test output dirs

* remove superfluous example_test

* prototype_sf

* prototype_arc

* prototype_marin

* move dirs

* psrc

* semcog

* sandag_xborder

* placeholder_sandag

* placeholder_multiple_zone

* no more coveralls

* repair docs

* clean up example names

* black and isort (ActivitySim#578)

* black and isort

* stop emitting output dir

it fails later tests

* trace files in nested directories

because windows

* swap files for xborder model

* repair ARC MP

* print checksum even when not used

* add hashes for sandag_xborder_full

* fix dtype in university hack

* fix persons to match tours

* repair ARC

* Bump version: 1.0.4 → 1.1.0

* Added mwcog small area

* missed one edit

* reformatting

* Update README.MD

* call as module

* github actions tests

* pre commit hooks

* pyproject toml

* limit numpy

* docs for mamba instead of conda

* ignore generated files

* add nbmake to test env

* fix dupe line

* repair test multiple zones for github actions

* publish develop docs

* fix docbuild env

* Update .travis.yml

* fixed testing files

* fixed testing files (again)

* fixed test script again

* publish docs to branch name

* updated testing scripts (note shorter travis script for now)

* fixed slash (windows vs. linux testing issue)

* added output folders

* updated travis script to run all tests, should pass

* docs cleaning

* docs re-style

* rebuild

* dynamic versioning docs

* version switcher

* blacken

* fix switcher url

* fix conf

* switcher update

* master to main

* deployment actions

* actions

* build wheel

* fix for testpypi

* blacken

* manual switcher

* branch docs service [makedocs]

* syntax [makedocs]

* travis depends

* checkout v3, fix versioning in docs

* only build develop docs once

* failsafe version

* documentation repairs

* python-simplified-semver

* front cards

* end testing w travis

* add mwcog test to gh-actions

* add mwcog to docs

* point to data not copy it

* sort dependencies

* req sh 2.2.4

* account for variance across platforms in trip dest est

* copy bike skims for sandag test

* param on rtol

* fix sandag_2 test files

* fix test file names

* added pre-processor option to trip scheduling

* trip scheduling relative mode initial commit

* moved everything to mwcog example

* adding output analysis notebook

* adding additional segmentation

* testing and documentation

* blacken

* not assuming scheduling mode is set

* fixing merge trip scheduling

* still fixing merge

* reverting regression trips

* fixing bad merge and updating test

Co-authored-by: Jeffrey Newman <jeffnewman@camsys.com>
Co-authored-by: Andrew Rohne <andrew@siliconcreek.net>

* adding annotate to trip mode choice

* no earliest change if previous trip fail

Co-authored-by: David Hensle <davidh@sandag.org>
Co-authored-by: Jeffrey Newman <jeffnewman@camsys.com>
Co-authored-by: Andrew Rohne <andrew@siliconcreek.net>
  • Loading branch information
4 people authored Dec 21, 2022
1 parent 9506f16 commit c474a26
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion activitysim/abm/models/trip_mode_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from activitysim.core.pathbuilder import TransitVirtualPathBuilder
from activitysim.core.util import assign_in_place

from .util import estimation
from .util import estimation, annotate
from .util.mode import mode_choice_simulate

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -283,6 +283,9 @@ def trip_mode_choice(trips, network_los, chunk_size, trace_hh_id):

pipeline.replace_table("trips", trips_df)

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

if trace_hh_id:
tracing.trace_df(
trips_df,
Expand Down
7 changes: 5 additions & 2 deletions activitysim/abm/models/trip_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,11 @@ def update_tour_earliest(trips, outbound_choices):

# set the trips "earliest" column equal to the max outbound departure
# time for all inbound trips. preserve values that were used for outbound trips
tmp_trips["earliest"] = tmp_trips["earliest"].where(
tmp_trips["outbound"], tmp_trips["max_outbound_departure"]
# FIXME - extra logic added because max_outbound_departure can be NA if previous failed trip was removed
tmp_trips["earliest"] = np.where(
~tmp_trips["outbound"] & ~tmp_trips["max_outbound_departure"].isna(),
tmp_trips["max_outbound_departure"],
tmp_trips["earliest"],
)

trips["earliest"] = tmp_trips["earliest"].reindex(trips.index)
Expand Down
2 changes: 1 addition & 1 deletion activitysim/abm/models/util/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def annotate_trips(model_settings, trace_label):
model_settings : dict
trace_label : str
"""
tours = inject.get_table("trips").to_frame()
trips = inject.get_table("trips").to_frame()
expressions.assign_columns(
df=trips,
model_settings=model_settings.get("annotate_trips"),
Expand Down
4 changes: 2 additions & 2 deletions activitysim/abm/tables/shadow_pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ def update_shadow_prices(self):
new_shadow_prices.where(
self.modeled_size > 0, self.shadow_prices, inplace=True
)
self.shadow_prices = new_shadow_prices

elif shadow_price_method == "daysim":
# - Daysim
Expand Down Expand Up @@ -734,6 +735,7 @@ def update_shadow_prices(self):
)

new_shadow_prices = self.shadow_prices + adjustment
self.shadow_prices = new_shadow_prices

elif shadow_price_method == "simulation":
# - NewMethod
Expand Down Expand Up @@ -836,8 +838,6 @@ def update_shadow_prices(self):
else:
raise RuntimeError("unknown SHADOW_PRICE_METHOD %s" % shadow_price_method)

# self.shadow_prices = new_shadow_prices

def dest_size_terms(self, segment):

assert segment in self.segment_ids
Expand Down

0 comments on commit c474a26

Please sign in to comment.