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_df
initialize_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_FILE
read_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_CATEGORICAL
path invalidated before ever chosen due to capacity problems
BUMP_BUFFER
Extra time so passengers don't get bumped (?).
BUMP_ONE_AT_A_TIME
Simulation: bump one stop at a time (slower, more accurate)
CAPACITY_CONSTRAINT
Route choice configuration: Use vehicle capacity constraints.
CHOSEN_CATEGORIES
These will be ordered, so to select chosen, choose those > CHOSEN_NOT_CHOSEN_YET
CHOSEN_NOT_CHOSEN_YET
categories for SIM_COL_PAX_CHOSEN
CHOSEN_REJECTED
CONFIGURATION_FILE
Configuration file for fasttrips
CONFIGURATION_FUNCTIONS_FILE
Configuration functions
CONFIGURATION_OUTPUT_FILE
Output copy of the configuration file in case anything got overridden (Hmm naming conventions are a bit awkward here)
CONVERGENCE_GAP
CREATE_SKIMS
Configuration: Create skims flag.
DEBUG_NUM_TRIPS
Debug mode: only run this number of trips, -1 to run all.
DEBUG_OUTPUT_COLUMNS
Debug: include debug columns in output
DEBUG_TRACE_ONLY
Debug mode: only run trace passengers
FARE_ZONE_SYMMETRY
INPUT_DEMAND_DIR
Configuration: Input demand directory
INPUT_NETWORK_ARCHIVE
Configuration: Input network directory
INPUT_WEIGHTS
Configuration: Pathweight parameters
MAX_ITERATIONS
Configuration: Maximum number of iterations to remove capacity violations.
MAX_NUM_PATHS
Route choice configuration: Max number of paths in a pathset.
MAX_PF_ITERATIONS
MAX_SIMULATION_ITERS
How many Simulation Iterations should we do before going back to path-finding?
MIN_PATH_PROBABILITY
Route choice configuration: Minimum path probability for the path to be used.
MSA_RESULTS
MSA the results that affect the next iteration to avoid oscillation: boards, alights, overcap onboard at stops
NETWORK_BUILD_DATE
NETWORK_BUILD_DATE_START_TIME
NUMBER_OF_PROCESSES
Number 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_DIR
Configuration: Run Configuration
OUTPUT_PASSENGER_TRAJECTORIES
Configuration: Passenger trajectory output flag.
OUTPUT_PATHSET_PER_SIM_ITER
Configuration: If true, outputs pathset every simulation iteration.
PATHFINDING_EVERYONE
Are we finding paths for everyone right now? Or just un-arrived folks?
PATHFINDING_TYPE
Configuration: Pathfinding Type.
PATHFINDING_TYPE_DETERMINISTIC
Find paths deterministically, using shortest path search based on travel time.
PATHFINDING_TYPE_READ_FILE
Don't find paths; read
Passenger.PF_PATHS_CSV
andPassenger.PF_LINKS_CSV
.PATHFINDING_TYPE_STOCHASTIC
Find paths stochastically using trip-based hyperpath
PREPEND_ROUTE_ID_TO_TRIP_ID
Prepend 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
SIMULATION
Configuration: Do simulation? It should be True for iterative assignment.
SIM_COL_MISSED_XFER
Is 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_MIN
Delay in alight_time from original pathfinding understanding of alight time
SIM_COL_PAX_ALIGHT_TIME
Alight time from the transit vehicle
SIM_COL_PAX_A_TIME
Time of arrival at A
SIM_COL_PAX_BOARD_STATE
NaN if not relevent, 1 if lucky enough to board at an at- or over-capacity stop, 0 if bumped.
SIM_COL_PAX_BOARD_TIME
Board time on the transit vehicle
SIM_COL_PAX_BUMP_ITER
SIM_COL_PAX_B_TIME
Time of arrival at B
SIM_COL_PAX_CHOSEN
Chosen status for path
SIM_COL_PAX_COST
Link cost.
SIM_COL_PAX_DISTANCE
Link distance
SIM_COL_PAX_FARE
Link fare in currency
SIM_COL_PAX_FARE_PERIOD
Fare period id
SIM_COL_PAX_FREE_TRANSFER
Free transfer? NaN, 0.0 or 1.0, only free based on fare_attributes_ft.txt
SIM_COL_PAX_LINK_TIME
Link time (SIM_COL_PAX_B_TIME - SIM_COL_PAX_A_TIME)
SIM_COL_PAX_LNPS
log(PathSize)
SIM_COL_PAX_LOGSUM
Logsum of all paths
SIM_COL_PAX_MISSED_XFER
Is this link a missed transfer
SIM_COL_PAX_OVERCAP
SIM_COL_PAX_OVERCAP_FRAC
If board at an overcap stop, fraction of boards that are overcap
SIM_COL_PAX_PROBABILITY
Probability of this path
SIM_COL_PAX_WAIT_TIME
Wait time
SKIP_PERSON_IDS
Skip these passengers
STOCH_DISPERSION
Route choice configuration: Dispersion parameter in the logit function.
STOCH_MAX_STOP_PROCESS_COUNT
Route choice configuration: How many times max times should we process a stop during labeling? Use -1 to specify no max.
STOCH_PATHSET_SIZE
Route choice configuration: How many stochastic paths will we generate (not necessarily unique) to define a path choice set? Int.
TIME_WINDOW
Configuration: Path time-window.
TRACE_IDS
Trace these persons/person trips (a list of tuples)
TRANSFER_FARE_IGNORE_PATHENUM
In path-enumeration, suppress trying to adjust fares using transfer fare rules.
TRANSFER_FARE_IGNORE_PATHFINDING
In path-finding, suppress trying to adjust fares using transfer fare rules.
UTILS_CONVERSION
Stop 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_wait
This 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