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

Relative Trip Scheduling #8

Draft
wants to merge 1 commit into
base: extended
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 28 additions & 7 deletions ext-configs/trip_scheduling.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
PROBS_SPEC: trip_scheduling_probs.csv
COEFFICIENTS: trip_scheduling_coefficients.csv

# int to add to probs column index to get time period it represents.
# e.g. depart_alt_base = 5 means first column (column 0) represents 5 am
DEPART_ALT_BASE: 5
# e.g. depart_alt_base = 0 means first column (column 0) represents 0 periods after (same period as) the previous trip
DEPART_ALT_BASE: 0

MAX_ITERATIONS: 100
MAX_ITERATIONS: 5

# FAILFIX: drop_and_cleanup
#FAILFIX: drop_and_cleanup
FAILFIX: choose_most_initial

# --- relative trip scheduling settings
PROBS_SPEC: trip_scheduling_probs.csv

scheduling_mode: relative

probs_join_cols:
- periods_left_min
- periods_left_max
- outbound
- tour_purpose_grouped
- half_tour_stops_remaining_grouped

preprocessor:
SPEC: trip_scheduling_preprocessor
DF: choosers
TABLES:
- tours

logic_version: 2




8 changes: 8 additions & 0 deletions ext-configs/trip_scheduling_preprocessor.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Description,Target,Expression
,periods_left,(df.latest - df.earliest)
# binning the periods differently for inbound and outbound
,periods_left_min,"np.where(df['outbound'], periods_left.clip(upper=13), periods_left.clip(upper=17))"
,periods_left_max,"np.where(((periods_left >= 13) & (df['outbound'])) | ((periods_left >= 17) & (~df['outbound'])), 23, periods_left)"
,tour_purpose,"reindex(tours.tour_type, df.tour_id)"
,tour_purpose_grouped,"np.where(tour_purpose.isin(['work','school','univ']), 'mand', 'non_mand')"
,half_tour_stops_remaining_grouped,(df.trip_count - df.trip_num).clip(upper=1)
Loading