fasttrips.Assignment
- class fasttrips.Assignment[source]
Assignment class. Documentation forthcoming.
Methods
__init__()This does nothing.
assign_paths(output_dir, FT)Finds the paths for the passengers.
choose_paths_without_simulation(FT, ...)Given a pathset for each passernger, choose a path (if relevant).
compare_choices(pathset_paths_df, prior_choice)Reads in a pathset_path_df and the pathset_path_df of a prior iteration and returns the number of new choices made in the current iteration along with a simplified chosen df to use in the next iteration.
filter_trip_list_to_not_arrived(...)Filter the given trip list to only those that have not arrived according to pathset_paths_df.
find_passenger_vehicle_times(...[, is_skimming])Given a dataframe of passenger links and a dataframe of vehicle trip links, adds two new columns to the passenger links for board and alight time.
find_trip_based_pathset(iteration, ...)Perform trip-based path set search.
flag_missed_transfers(pathset_paths_df, ...)Given passenger pathset links with the vehicle board_time and alight_time attached to trip links, this method will add columns to determine if there are missed transfers.
generate_pathsets(FT, pathset_paths_df, ...)Figures out which person trips for whom to generate_pathsets, stored in
Passenger.pathfind_trip_list_dfinitialize_fasttrips_extension(...)Initialize the C++ fasttrips extension by passing it the network supply.
load_passengers_on_vehicles_with_cap(...)Check if we have boards on over-capacity vehicles.
merge_pathsets(pathfind_trip_list_df, ...)Merge the given new pathset paths and links into the existing
merge_prior_choices(pathset_paths_df, ...)Join success or bump flag count information onto a pathset_paths_df and pathset_links_df :param pathset_paths_df: Current iteration of pathset_paths_df.
number_of_pathsets(pathset_paths_df)Counts the number of passenger trips with pathsets and returns it.
process_weight_qualifiers(weights)Qualifiers are used to change the default behavior of weight_names.
put_passengers_on_vehicles(pathset_links_df, ...)Puts the chosen passenger trips specified in pathset_links_df onto the transit vehicle trips specified by veh_trip_df.
read_configuration(config_fullpath)Read the configuration parameters from
Assignment.CONFIGURATION_FILEread_functions(func_file)Read the functions from :py:attr:`Assignment.CONFIGURATION_FUNCTIONS_FILE
read_weights([weights_file])Read the weights from :py:attr:`Assignment.INPUT_WEIGHTS
save_choices(pathset_paths_df, success_df, ...)Returns an updated count of successfully chosen paths and paths that were bumped for each user. :param pathset_paths_df: Current iteration of pathset_paths_df after simulation. :param success_df: Count of chosen paths for each user across prior iterations :param bump_df: Count of bumped paths for each user across prior iterations :return: success_df: Updated count of chosen paths for each user across each iteration bump_df: Updated count of bumped paths for each user across each iteration.
set_fasttrips_bump_wait(bump_wait_df)Sends the bump wait information to the fasttrips extension
simulate(FT, output_dir, iteration, ...)Given a pathset for each passenger, choose a path (if relevant) and then actually assign the passengers trips to the vehicles.
write_configuration(output_dir)Write the configuration parameters to function as a record with the output.
write_vehicle_trips(output_dir, iteration, ...)Attributes
BOARD_STATE_CATEGORICALpath invalidated before ever chosen due to capacity problems
BUMP_BUFFERExtra time so passengers don't get bumped (?).
BUMP_ONE_AT_A_TIMESimulation: bump one stop at a time (slower, more accurate)
CAPACITY_CONSTRAINTRoute choice configuration: Use vehicle capacity constraints.
CHOSEN_CATEGORIESThese will be ordered, so to select chosen, choose those > CHOSEN_NOT_CHOSEN_YET
CHOSEN_NOT_CHOSEN_YETcategories for SIM_COL_PAX_CHOSEN
CHOSEN_REJECTEDCONFIGURATION_FILEConfiguration file for fasttrips
CONFIGURATION_FUNCTIONS_FILEConfiguration functions
CONFIGURATION_OUTPUT_FILEOutput copy of the configuration file in case anything got overridden (Hmm naming conventions are a bit awkward here)
CONVERGENCE_GAPCREATE_SKIMSConfiguration: Create skims flag.
DEBUG_NUM_TRIPSDebug mode: only run this number of trips, -1 to run all.
DEBUG_OUTPUT_COLUMNSDebug: include debug columns in output
DEBUG_TRACE_ONLYDebug mode: only run trace passengers
FARE_ZONE_SYMMETRYINPUT_DEMAND_DIRConfiguration: Input demand directory
INPUT_NETWORK_ARCHIVEConfiguration: Input network directory
INPUT_WEIGHTSConfiguration: Pathweight parameters
MAX_ITERATIONSConfiguration: Maximum number of iterations to remove capacity violations.
MAX_NUM_PATHSRoute choice configuration: Max number of paths in a pathset.
MAX_PF_ITERATIONSMAX_SIMULATION_ITERSHow many Simulation Iterations should we do before going back to path-finding?
MIN_PATH_PROBABILITYRoute choice configuration: Minimum path probability for the path to be used.
MSA_RESULTSMSA the results that affect the next iteration to avoid oscillation: boards, alights, overcap onboard at stops
NETWORK_BUILD_DATENETWORK_BUILD_DATE_START_TIMENUMBER_OF_PROCESSESNumber of processes to use for path finding (via
multiprocessing) Set to 1 to run everything in this process Set to less than 1 to use the result ofmultiprocessing.cpu_count()Set to positive integer greater than 1 to set a fixed number of processesOUTPUT_DIRConfiguration: Run Configuration
OUTPUT_PASSENGER_TRAJECTORIESConfiguration: Passenger trajectory output flag.
OUTPUT_PATHSET_PER_SIM_ITERConfiguration: If true, outputs pathset every simulation iteration.
PATHFINDING_EVERYONEAre we finding paths for everyone right now? Or just un-arrived folks?
PATHFINDING_TYPEConfiguration: Pathfinding Type.
PATHFINDING_TYPE_DETERMINISTICFind paths deterministically, using shortest path search based on travel time.
PATHFINDING_TYPE_READ_FILEDon't find paths; read
Passenger.PF_PATHS_CSVandPassenger.PF_LINKS_CSV.PATHFINDING_TYPE_STOCHASTICFind paths stochastically using trip-based hyperpath
PREPEND_ROUTE_ID_TO_TRIP_IDPrepend the route id to the trip id? This is for readability in debugging, since route IDs are typically more readable and trip ids are inscrutable
SIMULATIONConfiguration: Do simulation? It should be True for iterative assignment.
SIM_COL_MISSED_XFERIs this link/path a missed transfer? Set in both pathset links and pathset paths, this is a 1 or 0
SIM_COL_PAX_ALIGHT_DELAY_MINDelay in alight_time from original pathfinding understanding of alight time
SIM_COL_PAX_ALIGHT_TIMEAlight time from the transit vehicle
SIM_COL_PAX_A_TIMETime of arrival at A
SIM_COL_PAX_BOARD_STATENaN if not relevent, 1 if lucky enough to board at an at- or over-capacity stop, 0 if bumped.
SIM_COL_PAX_BOARD_TIMEBoard time on the transit vehicle
SIM_COL_PAX_BUMP_ITERSIM_COL_PAX_B_TIMETime of arrival at B
SIM_COL_PAX_CHOSENChosen status for path
SIM_COL_PAX_COSTLink cost.
SIM_COL_PAX_DISTANCELink distance
SIM_COL_PAX_FARELink fare in currency
SIM_COL_PAX_FARE_PERIODFare period id
SIM_COL_PAX_FREE_TRANSFERFree transfer? NaN, 0.0 or 1.0, only free based on fare_attributes_ft.txt
SIM_COL_PAX_LINK_TIMELink time (SIM_COL_PAX_B_TIME - SIM_COL_PAX_A_TIME)
SIM_COL_PAX_LNPSlog(PathSize)
SIM_COL_PAX_LOGSUMLogsum of all paths
SIM_COL_PAX_MISSED_XFERIs this link a missed transfer
SIM_COL_PAX_OVERCAPSIM_COL_PAX_OVERCAP_FRACIf board at an overcap stop, fraction of boards that are overcap
SIM_COL_PAX_PROBABILITYProbability of this path
SIM_COL_PAX_WAIT_TIMEWait time
SKIP_PERSON_IDSSkip these passengers
STOCH_DISPERSIONRoute choice configuration: Dispersion parameter in the logit function.
STOCH_MAX_STOP_PROCESS_COUNTRoute choice configuration: How many times max times should we process a stop during labeling? Use -1 to specify no max.
STOCH_PATHSET_SIZERoute choice configuration: How many stochastic paths will we generate (not necessarily unique) to define a path choice set? Int.
TIME_WINDOWConfiguration: Path time-window.
TRACE_IDSTrace these persons/person trips (a list of tuples)
TRANSFER_FARE_IGNORE_PATHENUMIn path-enumeration, suppress trying to adjust fares using transfer fare rules.
TRANSFER_FARE_IGNORE_PATHFINDINGIn path-finding, suppress trying to adjust fares using transfer fare rules.
UTILS_CONVERSIONStop labeling configuration: Multiplies the utilities by this factor so that there are not negative costs labels which can result in lengthy and ineffective path-finding.
bump_waitThis is the only simulation state that exists across iterations It's a dictionary of (trip_id, stop_id) -> earliest time a bumped passenger started waiting
bump_wait_df