public class MatchGraphRequest extends Object implements org.apache.avro.generic.IndexedRecord
GPUdb.matchGraph(MatchGraphRequest)
.
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.
Modifier and Type | Class and Description |
---|---|
static class |
MatchGraphRequest.Options
Additional parameters
GPS_NOISE : GPS
noise value (in meters) to remove redundant sample points. |
static class |
MatchGraphRequest.SolveMethod
The type of solver to use for graph matching.
|
Constructor and Description |
---|
MatchGraphRequest()
Constructs a MatchGraphRequest object with default parameters.
|
MatchGraphRequest(String graphName,
List<String> samplePoints,
String solveMethod,
String solutionTable,
Map<String,String> options)
Constructs a MatchGraphRequest object with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Object |
get(int index)
This method supports the Avro framework and is not intended to be called
directly by the user.
|
static org.apache.avro.Schema |
getClassSchema()
This method supports the Avro framework and is not intended to be called
directly by the user.
|
String |
getGraphName() |
Map<String,String> |
getOptions() |
List<String> |
getSamplePoints() |
org.apache.avro.Schema |
getSchema()
This method supports the Avro framework and is not intended to be called
directly by the user.
|
String |
getSolutionTable() |
String |
getSolveMethod() |
int |
hashCode() |
void |
put(int index,
Object value)
This method supports the Avro framework and is not intended to be called
directly by the user.
|
MatchGraphRequest |
setGraphName(String graphName) |
MatchGraphRequest |
setOptions(Map<String,String> options) |
MatchGraphRequest |
setSamplePoints(List<String> samplePoints) |
MatchGraphRequest |
setSolutionTable(String solutionTable) |
MatchGraphRequest |
setSolveMethod(String solveMethod) |
String |
toString() |
public MatchGraphRequest()
public MatchGraphRequest(String graphName, List<String> samplePoints, String solveMethod, String solutionTable, Map<String,String> options)
graphName
- Name of the underlying geospatial graph resource to
match to using samplePoints
.samplePoints
- Sample 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'.solveMethod
- The type of solver to use for graph matching.
Supported values:
MARKOV_CHAIN
: Matches samplePoints
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_PAIRS
: Matches samplePoints
to
find the most probable path between origin and
destination pairs with cost constraints.
MATCH_SUPPLY_DEMAND
: Matches samplePoints
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_SOLVES
: Matches samplePoints
source and destination pairs for the shortest path
solves in batch mode.
MARKOV_CHAIN
.solutionTable
- The name of the table used to store the results;
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. Has the
same naming restrictions as tables. Must not be an existing
table of the same name. The default value is ''.options
- Additional parameters
GPS_NOISE
: GPS 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_SEGMENTS
: Maximum 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_RADIUS
: Maximum 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_WIDTH
: For 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'.
SOURCE
: Optional WKT starting point from samplePoints
for the solver. The default behavior for
the endpoint is to use time to determine the starting
point. The default value is 'POINT NULL'.
DESTINATION
: Optional WKT ending point from samplePoints
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
Supported values:
TRUE
:
Partial off-loading at multiple store (demand) locations
FALSE
: No partial off-loading allowed if supply is less
than the store's demand.
TRUE
.
MAX_COMBINATIONS
: For 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'.
LEFT_TURN_PENALTY
: This will add an additonal weight
over the edges labelled as 'left turn' if the 'add_turn'
option parameter of the GPUdb.createGraph(CreateGraphRequest)
was
invoked at graph creation. The default value is '0.0'.
RIGHT_TURN_PENALTY
: This will add an additonal weight
over the edges labelled as' right turn' if the
'add_turn' option parameter of the GPUdb.createGraph(CreateGraphRequest)
was
invoked at graph creation. The default value is '0.0'.
INTERSECTION_PENALTY
: This will add an additonal weight
over the edges labelled as 'intersection' if the
'add_turn' option parameter of the GPUdb.createGraph(CreateGraphRequest)
was
invoked at graph creation. The default value is '0.0'.
SHARP_TURN_PENALTY
: This will add an additonal weight
over the edges labelled as 'sharp turn' or 'u-turn' if
the 'add_turn' option parameter of the GPUdb.createGraph(CreateGraphRequest)
was
invoked at graph creation. The default value is '0.0'.
AGGREGATED_OUTPUT
: For 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'.
MAX_TRIP_COST
: For the match_supply_demand
solver only. If this constraint is greater than zero
(default) then the trucks will skip travelling from one
demand 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.
Supported values:
The default value is FALSE
.
UNIT_UNLOADING_COST
: For 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_THREADS
: For 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'.
TRUCK_SERVICE_LIMIT
: For the match_supply_demand
solver only. If specified (greather
than zero), any truck'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_TRUCK_REUSE
: For the match_supply_demand
solver only. If specified (true), all trucks can be
scheduled for second rounds from their originating
depots.
Supported values:
TRUE
:
Allows reusing trucks for scheduling again.
FALSE
: Trucks are scheduled only once from their
depots.
FALSE
.
Map
.public static org.apache.avro.Schema getClassSchema()
public String getGraphName()
samplePoints
.public MatchGraphRequest setGraphName(String graphName)
graphName
- Name of the underlying geospatial graph resource to
match to using samplePoints
.this
to mimic the builder pattern.public List<String> getSamplePoints()
public MatchGraphRequest setSamplePoints(List<String> samplePoints)
samplePoints
- Sample 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'.this
to mimic the builder pattern.public String getSolveMethod()
MARKOV_CHAIN
: Matches samplePoints
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_PAIRS
: Matches samplePoints
to find the most
probable path between origin and destination pairs with cost
constraints.
MATCH_SUPPLY_DEMAND
: Matches samplePoints
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_SOLVES
: Matches samplePoints
source and
destination pairs for the shortest path solves in batch mode.
MARKOV_CHAIN
.public MatchGraphRequest setSolveMethod(String solveMethod)
solveMethod
- The type of solver to use for graph matching.
Supported values:
MARKOV_CHAIN
: Matches samplePoints
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_PAIRS
: Matches samplePoints
to
find the most probable path between origin and
destination pairs with cost constraints.
MATCH_SUPPLY_DEMAND
: Matches samplePoints
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_SOLVES
: Matches samplePoints
source and destination pairs for the shortest path
solves in batch mode.
MARKOV_CHAIN
.this
to mimic the builder pattern.public String getSolutionTable()
public MatchGraphRequest setSolutionTable(String solutionTable)
solutionTable
- The name of the table used to store the results;
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. Has the
same naming restrictions as tables. Must not be an existing
table of the same name. The default value is ''.this
to mimic the builder pattern.public Map<String,String> getOptions()
GPS_NOISE
: GPS 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_SEGMENTS
: Maximum 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_RADIUS
: Maximum 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_WIDTH
: For 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'.
SOURCE
:
Optional WKT starting point from samplePoints
for the
solver. The default behavior for the endpoint is to use time to
determine the starting point. The default value is 'POINT
NULL'.
DESTINATION
: Optional WKT ending point from samplePoints
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
Supported values:
TRUE
: Partial
off-loading at multiple store (demand) locations
FALSE
: No
partial off-loading allowed if supply is less than the store's
demand.
TRUE
.
MAX_COMBINATIONS
: For 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'.
LEFT_TURN_PENALTY
: This will add an additonal weight over the
edges labelled as 'left turn' if the 'add_turn' option parameter
of the GPUdb.createGraph(CreateGraphRequest)
was invoked at graph creation. The default value is '0.0'.
RIGHT_TURN_PENALTY
: This will add an additonal weight over the
edges labelled as' right turn' if the 'add_turn' option
parameter of the GPUdb.createGraph(CreateGraphRequest)
was invoked at
graph creation. The default value is '0.0'.
INTERSECTION_PENALTY
: This will add an additonal weight over
the edges labelled as 'intersection' if the 'add_turn' option
parameter of the GPUdb.createGraph(CreateGraphRequest)
was invoked at
graph creation. The default value is '0.0'.
SHARP_TURN_PENALTY
: This will add an additonal weight over the
edges labelled as 'sharp turn' or 'u-turn' if the 'add_turn'
option parameter of the GPUdb.createGraph(CreateGraphRequest)
was invoked at
graph creation. The default value is '0.0'.
AGGREGATED_OUTPUT
: For 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'.
MAX_TRIP_COST
: For the match_supply_demand
solver only.
If this constraint is greater than zero (default) then the
trucks will skip travelling from one demand 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.
Supported values:
The default value is FALSE
.
UNIT_UNLOADING_COST
: For 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_THREADS
: For 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'.
TRUCK_SERVICE_LIMIT
: For the match_supply_demand
solver
only. If specified (greather than zero), any truck'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_TRUCK_REUSE
: For the match_supply_demand
solver
only. If specified (true), all trucks can be scheduled for
second rounds from their originating depots.
Supported values:
TRUE
: Allows
reusing trucks for scheduling again.
FALSE
:
Trucks are scheduled only once from their depots.
FALSE
.
Map
.public MatchGraphRequest setOptions(Map<String,String> options)
options
- Additional parameters
GPS_NOISE
: GPS 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_SEGMENTS
: Maximum 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_RADIUS
: Maximum 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_WIDTH
: For 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'.
SOURCE
: Optional WKT starting point from samplePoints
for the solver. The default behavior for
the endpoint is to use time to determine the starting
point. The default value is 'POINT NULL'.
DESTINATION
: Optional WKT ending point from samplePoints
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
Supported values:
TRUE
:
Partial off-loading at multiple store (demand) locations
FALSE
: No partial off-loading allowed if supply is less
than the store's demand.
TRUE
.
MAX_COMBINATIONS
: For 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'.
LEFT_TURN_PENALTY
: This will add an additonal weight
over the edges labelled as 'left turn' if the 'add_turn'
option parameter of the GPUdb.createGraph(CreateGraphRequest)
was
invoked at graph creation. The default value is '0.0'.
RIGHT_TURN_PENALTY
: This will add an additonal weight
over the edges labelled as' right turn' if the
'add_turn' option parameter of the GPUdb.createGraph(CreateGraphRequest)
was
invoked at graph creation. The default value is '0.0'.
INTERSECTION_PENALTY
: This will add an additonal weight
over the edges labelled as 'intersection' if the
'add_turn' option parameter of the GPUdb.createGraph(CreateGraphRequest)
was
invoked at graph creation. The default value is '0.0'.
SHARP_TURN_PENALTY
: This will add an additonal weight
over the edges labelled as 'sharp turn' or 'u-turn' if
the 'add_turn' option parameter of the GPUdb.createGraph(CreateGraphRequest)
was
invoked at graph creation. The default value is '0.0'.
AGGREGATED_OUTPUT
: For 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'.
MAX_TRIP_COST
: For the match_supply_demand
solver only. If this constraint is greater than zero
(default) then the trucks will skip travelling from one
demand 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.
Supported values:
The default value is FALSE
.
UNIT_UNLOADING_COST
: For 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_THREADS
: For 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'.
TRUCK_SERVICE_LIMIT
: For the match_supply_demand
solver only. If specified (greather
than zero), any truck'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_TRUCK_REUSE
: For the match_supply_demand
solver only. If specified (true), all trucks can be
scheduled for second rounds from their originating
depots.
Supported values:
TRUE
:
Allows reusing trucks for scheduling again.
FALSE
: Trucks are scheduled only once from their
depots.
FALSE
.
Map
.this
to mimic the builder pattern.public org.apache.avro.Schema getSchema()
getSchema
in interface org.apache.avro.generic.GenericContainer
public Object get(int index)
get
in interface org.apache.avro.generic.IndexedRecord
index
- the position of the field to getIndexOutOfBoundsException
public void put(int index, Object value)
put
in interface org.apache.avro.generic.IndexedRecord
index
- the position of the field to setvalue
- the value to setIndexOutOfBoundsException
Copyright © 2020. All rights reserved.