/match/graph

URL: https://<aws.fqdn>/<aws.cluster.name>/gpudb-0/match/graph

Matches a directed route implied by a given set of latitude/longitude points to an existing underlying road network graph using a given solution type.

IMPORTANT: It's highly recommended that you review the Network Graphs & Solvers concepts documentation, the Graph REST Tutorial, and/or some /match/graph examples before using this endpoint.

Input Parameter Description

NameTypeDescription
graph_namestringName of the underlying geospatial graph resource to match to using input parameter sample_points.
sample_pointsarray of stringsSample points used to match to an underlying geospatial graph. Sample points must be specified using identifiers; identifiers are grouped as combinations. Identifiers can be used with: existing column names, e.g., 'table.column AS SAMPLE_X'; expressions, e.g., 'ST_MAKEPOINT(table.x, table.y) AS SAMPLE_WKTPOINT'; or constant values, e.g., '{1, 2, 10} AS SAMPLE_TRIPID'.
solve_methodstring

The type of solver to use for graph matching. The default value is markov_chain.

Supported ValuesDescription
markov_chainMatches input parameter sample_points to the graph using the Hidden Markov Model (HMM)-based method, which conducts a range-tree closest-edge search to find the best combinations of possible road segments (num_segments) for each sample point to create the best route. The route is secured one point at a time while looking ahead chain_width number of points, so the prediction is corrected after each point. This solution type is the most accurate but also the most computationally intensive. Related options: num_segments and chain_width.
match_od_pairsMatches input parameter sample_points to find the most probable path between origin and destination pairs with cost constraints.
match_supply_demandMatches input parameter sample_points to optimize scheduling multiple supplies (trucks) with varying sizes to varying demand sites with varying capacities per depot. Related options: partial_loading and max_combinations.
match_batch_solvesMatches input parameter sample_points source and destination pairs for the shortest path solves in batch mode.
match_loopsMatches closed loops (Eulerian paths) originating and ending at each graph node within min and max hops (levels).
match_charging_stationsMatches an optimal path across a number of ev-charging stations between source and target locations.
match_similarityMatches the intersection set(s) by computing the Jaccard similarity score between node pairs.
match_pickup_dropoffMatches the pickups and dropoffs by optimizing the total trip costs
match_clustersMatches the graph nodes with a cluster index using Louvain clustering algorithm
match_patternMatches a pattern in the graph
solution_tablestringThe name of the table used to store the results, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. This table contains a track of geospatial points for the matched portion of the graph, a track ID, and a score value. Also outputs a details table containing a trip ID (that matches the track ID), the latitude/longitude pair, the timestamp the point was recorded at, and an edge ID corresponding to the matched road segment. Must not be an existing table of the same name. The default value is ''.
optionsmap of string to strings

Additional parameters. The default value is an empty map ( {} ).

Supported Parameters (keys)Parameter Description
gps_noiseGPS noise value (in meters) to remove redundant sample points. Use -1 to disable noise reduction. The default value accounts for 95% of point variation (+ or -5 meters). The default value is '5.0'.
num_segmentsMaximum number of potentially matching road segments for each sample point. For the markov_chain solver, the default is 3. The default value is '3'.
search_radiusMaximum search radius used when snapping sample points onto potentially matching surrounding segments. The default value corresponds to approximately 100 meters. The default value is '0.001'.
chain_widthFor the markov_chain solver only. Length of the sample points lookahead window within the Markov kernel; the larger the number, the more accurate the solution. The default value is '9'.
sourceOptional WKT starting point from input parameter sample_points for the solver. The default behavior for the endpoint is to use time to determine the starting point. The default value is 'POINT NULL'.
destinationOptional WKT ending point from input parameter sample_points for the solver. The default behavior for the endpoint is to use time to determine the destination point. The default value is 'POINT NULL'.
partial_loading

For the match_supply_demand solver only. When false (non-default), trucks do not off-load at the demand (store) side if the remainder is less than the store's need The default value is true.

Supported ValuesDescription
truePartial off-loading at multiple store (demand) locations
falseNo partial off-loading allowed if supply is less than the store's demand.
max_combinationsFor the match_supply_demand solver only. This is the cutoff for the number of generated combinations for sequencing the demand locations - can increase this up to 2M. The default value is '10000'.
max_supply_combinationsFor the match_supply_demand solver only. This is the cutoff for the number of generated combinations for sequencing the supply locations if/when 'permute_supplies' is true. The default value is '10000'.
left_turn_penaltyThis will add an additonal weight over the edges labelled as 'left turn' if the 'add_turn' option parameter of the /create/graph was invoked at graph creation. The default value is '0.0'.
right_turn_penaltyThis will add an additonal weight over the edges labelled as' right turn' if the 'add_turn' option parameter of the /create/graph was invoked at graph creation. The default value is '0.0'.
intersection_penaltyThis will add an additonal weight over the edges labelled as 'intersection' if the 'add_turn' option parameter of the /create/graph was invoked at graph creation. The default value is '0.0'.
sharp_turn_penaltyThis will add an additonal weight over the edges labelled as 'sharp turn' or 'u-turn' if the 'add_turn' option parameter of the /create/graph was invoked at graph creation. The default value is '0.0'.
aggregated_outputFor the match_supply_demand solver only. When it is true (default), each record in the output table shows a particular truck's scheduled cumulative round trip path (MULTILINESTRING) and the corresponding aggregated cost. Otherwise, each record shows a single scheduled truck route (LINESTRING) towards a particular demand location (store id) with its corresponding cost. The default value is 'true'.
output_tracksFor the match_supply_demand solver only. When it is true (non-default), the output will be in tracks format for all the round trips of each truck in which the timestamps are populated directly from the edge weights starting from their originating depots. The default value is 'false'.
max_trip_costFor the match_supply_demand and match_pickup_dropoff solvers only. If this constraint is greater than zero (default) then the trucks/rides will skip travelling from one demand/pick location to another if the cost between them is greater than this number (distance or time). Zero (default) value means no check is performed. The default value is '0.0'.
filter_folding_paths

For the markov_chain solver only. When true (non-default), the paths per sequence combination is checked for folding over patterns and can significantly increase the execution time depending on the chain width and the number of gps samples. The default value is false.

Supported ValuesDescription
trueFilter out the folded paths.
falseDo not filter out the folded paths
unit_unloading_costFor the match_supply_demand solver only. The unit cost per load amount to be delivered. If this value is greater than zero (default) then the additional cost of this unit load multiplied by the total dropped load will be added over to the trip cost to the demand location. The default value is '0.0'.
max_num_threadsFor the markov_chain solver only. If specified (greater than zero), the maximum number of threads will not be greater than the specified value. It can be lower due to the memory and the number cores available. Default value of zero allows the algorithm to set the maximal number of threads within these constraints. The default value is '0'.
service_limitFor the match_supply_demand solver only. If specified (greater than zero), any supply actor's total service cost (distance or time) will be limited by the specified value including multiple rounds (if set). The default value is '0.0'.
enable_reuse

For the match_supply_demand solver only. If specified (true), all supply actors can be scheduled for second rounds from their originating depots. The default value is false.

Supported ValuesDescription
trueAllows reusing supply actors (trucks, e.g.) for scheduling again.
falseSupply actors are scheduled only once from their depots.
max_stopsFor the match_supply_demand solver only. If specified (greater than zero), a supply actor (truck) can at most have this many stops (demand locations) in one round trip. Otherwise, it is unlimited. If 'enable_truck_reuse' is on, this condition will be applied separately at each round trip use of the same truck. The default value is '0'.
service_radiusFor the match_supply_demand and match_pickup_dropoff solvers only. If specified (greater than zero), it filters the demands/picks outside this radius centered around the supply actor/ride's originating location (distance or time). The default value is '0.0'.
permute_supplies

For the match_supply_demand solver only. If specified (true), supply side actors are permuted for the demand combinations during msdo optimization - note that this option increases optimization time significantly - use of 'max_combinations' option is recommended to prevent prohibitively long runs The default value is true.

Supported ValuesDescription
trueGenerates sequences over supply side permutations if total supply is less than twice the total demand
falsePermutations are not performed, rather a specific order of supplies based on capacity is computed
batch_tsm_mode

For the match_supply_demand solver only. When enabled, it sets the number of visits on each demand location by a single salesman at each trip is considered to be (one) 1, otherwise there is no bound. The default value is false.

Supported ValuesDescription
trueSets only one visit per demand location by a salesman (tsm mode)
falseNo preset limit (usual msdo mode)
round_trip

For the match_supply_demand solver only. When enabled, the supply will have to return back to the origination location. The default value is true.

Supported ValuesDescription
trueThe optimization is done for trips in round trip manner always returning to originating locations
falseSupplies do not have to come back to their originating locations in their routes. The routes are considered finished at the final dropoff.
num_cyclesFor the match_clusters solver only. Terminates the cluster exchange iterations across 2-step-cycles (outer loop) when quality does not improve during iterations. The default value is '10'.
num_loops_per_cycleFor the match_clusters solver only. Terminates the cluster exchanges within the first step iterations of a cycle (inner loop) unless convergence is reached. The default value is '10'.
num_output_clustersFor the match_clusters solver only. Limits the output to the top 'num_output_clusters' clusters based on density. Default value of zero outputs all clusters. The default value is '0'.
max_num_clustersFor the match_clusters solver only. If set (value greater than zero), it terminates when the number of clusters goes below than this number. The default value is '0'.
cluster_quality_metric

For the match_clusters solver only. The quality metric for Louvain modularity optimization solver. The default value is girvan.

Supported ValuesDescription
girvanUses the Newman Girvan quality metric for cluster solver
spectralApplies recursive spectral bisection (RSB) partitioning solver
restricted_type

For the match_supply_demand solver only. Optimization is performed by restricting routes labeled by 'MSDO_ODDEVEN_RESTRICTED' only for this supply actor (truck) type The default value is none.

Supported ValuesDescription
oddApplies odd/even rule restrictions to odd tagged vehicles.
evenApplies odd/even rule restrictions to even tagged vehicles.
noneDoes not apply odd/even rule restrictions to any vehicles.
server_idIndicates which graph server(s) to send the request to. Default is to send to the server, amongst those containing the corresponding graph, that has the most computational bandwidth. The default value is ''.
inverse_solve

For the match_batch_solves solver only. Solves source-destination pairs using inverse shortest path solver. The default value is false.

Supported ValuesDescription
trueSolves using inverse shortest path solver.
falseSolves using direct shortest path solver.
min_loop_levelFor the match_loops solver only. Finds closed loops around each node deducible not less than this minimal hop (level) deep. The default value is '0'.
max_loop_levelFor the match_loops solver only. Finds closed loops around each node deducible not more than this maximal hop (level) deep. The default value is '5'.
search_limitFor the match_loops solver only. Searches within this limit of nodes per vertex to detect loops. The value zero means there is no limit. The default value is '10000'.
output_batch_sizeFor the match_loops solver only. Uses this value as the batch size of the number of loops in flushing(inserting) to the output table. The default value is '1000'.
charging_capacityFor the match_charging_stations solver only. This is the maximum ev-charging capacity of a vehicle (distance in meters or time in seconds depending on the unit of the graph weights). The default value is '300000.0'.
charging_candidatesFor the match_charging_stations solver only. Solver searches for this many number of stations closest around each base charging location found by capacity. The default value is '10'.
charging_penaltyFor the match_charging_stations solver only. This is the penalty for full charging. The default value is '30000.0'.
max_hopsFor the match_similarity solver only. Searches within this maximum hops for source and target node pairs to compute the Jaccard scores. The default value is '3'.
traversal_node_limitFor the match_similarity solver only. Limits the traversal depth if it reaches this many number of nodes. The default value is '1000'.
paired_similarity

For the match_similarity solver only. If true, it computes Jaccard score between each pair, otherwise it will compute Jaccard from the intersection set between the source and target nodes The default value is true. The supported values are:

  • true
  • false
force_undirected

For the match_pattern solver only. Pattern matching will be using both pattern and graph as undirected if set to true. The default value is false. The supported values are:

  • true
  • false

Output Parameter Description

The GPUdb server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query. Here is a description of the various fields of the wrapper:

NameTypeDescription
statusString'OK' or 'ERROR'
messageStringEmpty if success or an error message
data_typeString'match_graph_response' or 'none' in case of an error
dataStringEmpty string
data_strJSON or String

This embedded JSON represents the result of the /match/graph endpoint:

NameTypeDescription
resultbooleanIndicates a successful solution.
match_scorefloatThe mean square error calculation representing the map matching score. Values closer to zero are better.
infomap of string to stringsAdditional information.

Empty string in case of an error.