Shortest circuit network distance estimation method based on learning model

By constructing a hierarchical grid tree and a multi-vector-based representation vector model in the road network, the Manhattan distance of the embedded vector of the road network vertices is directly calculated, which solves the problem of low efficiency in calculating the shortest circuit network distance in the existing technology, and achieves the following Fast calculation speed.

CN119416872APending Publication Date: 2025-02-11DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411431286.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-14
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

When calculating the shortest circuit network distance, the prior art needs to first calculate the shortest path, which will affect the calculation speed, especially when facing massive data, inefficient.

Method used

Using a learning model-based method, a hierarchical grid tree of road network is constructed, and training samples are obtained through heuristic sampling strategy and landmark-based sample selection strategy, a hierarchical representation vector model based on multi-vectors is constructed, and any two road networks are calculated. Manhattan distance of the embed vector of vertices to estimate the shortest distance.

Benefits of technology

The speed of calculating the shortest circuit network distance is improved, and the step of pre-querying the shortest path is avoided, so that efficient calculations can still be made under massive data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119416872A_ABST
    Figure CN119416872A_ABST
Patent Text Reader

Abstract

The invention discloses a shortest path network distance estimation method based on a learning model. The method comprises the following steps: constructing a road network layered grid tree about a road network node map; based on a heuristic sampling strategy and a landmark-based sample selection strategy, selecting a training sample for any layer of the road network layered grid tree to obtain a sample training set; constructing a multi-vector-based hierarchical representation vector model according to the road network hierarchical grid tree, and obtaining an embedded vector of each road network vertex in the road network node map according to the hierarchical representation vector model trained based on the sample training set; and calculating the Manhattan distance of the embedded vectors of any two road network vertexes to determine the shortest estimated distance of any two road network nodes. The problem that an existing traditional algorithm is low in calculation efficiency for mass data is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of shortest path network distance estimation, and in particular to a shortest path network distance estimation method based on a learning model. Background Art

[0002] The existing research mainly calculates the shortest path first when calculating the shortest network distance, and then calculates the shortest distance based on the shortest path. According to this idea, the calculation of the shortest distance is converted into the calculation of the shortest path, which greatly affects the calculation speed when facing massive data calculations, and thus cannot efficiently obtain the shortest network distance. Summary of the invention

[0003] The present invention provides a shortest path network distance estimation method based on a learning model to overcome the above technical problems.

[0004] In order to achieve the above object, the technical solution of the present invention is:

[0005] A method for estimating the shortest path network distance based on a learning model specifically comprises the following steps:

[0006] S1: Construct a hierarchical grid tree of road network nodes map;

[0007] S2: Based on the heuristic sampling strategy and the landmark-based sample selection strategy, training samples are selected from any layer of the road network hierarchical grid tree to obtain a sample training set;

[0008] S3: Construct a multi-vector based hierarchical representation vector model according to the road network hierarchical grid tree;

[0009] And according to the hierarchical representation vector model trained based on the sample training set, the embedding vector of each road network vertex in the road network node map is obtained;

[0010] The number of layers of the road network hierarchical grid tree is defined as L, and the nodes in the first L-1 layers of the road network hierarchical grid tree are used as road network nodes, and the nodes in the bottom L layers are used as road network vertices;

[0011] S4: Determine the shortest estimated distance between any two road network nodes by calculating the Manhattan distance of the embedded vectors of any two road network vertices.

[0012] Furthermore, the S1 specifically includes the following steps:

[0013] S11: defining a current root node of the initial road network structure, and obtaining the initial road network structure according to the road network node map based on the current root node, and storing each grid node grid of the initial road network structure into the set root.Vset;

[0014] S12: According to the set root.Vset, the grid node grid in the road network node map is divided into a number of primary sub-grids in a top-down recursive manner, and its grid node set is defined as {childgridi};

[0015] S13: taking each first-generation sub-grid as the current initial road network structure, and repeatedly executing step S12 to obtain a next-generation sub-grid, until the number of grid vertices in the grid node set of the next-generation sub-grid is less than a preset grid vertex threshold;

[0016] Then, an initial road network hierarchical grid tree about the road network node map is obtained;

[0017] S14: Based on the distance set calculation strategy, from the bottom to the top of the initial road network hierarchical grid tree, the distance set grid.childDist of the sub-grid node grid of each generation of sub-grids is obtained layer by layer, and then the final road network hierarchical grid tree is obtained;

[0018] Among them, childDist represents a sub-grid distance matrix, and the sub-grid distance matrix includes a lower triangular matrix for storing the shortest path network distances between sub-grids, and an upper triangular matrix for storing sub-grid node reference distances between sub-grids.

[0019] Furthermore, the S14 specifically includes the following steps:

[0020] S141: Obtain the subgrid nodes of each generation of subgrids in the initial road network hierarchical grid tree layer by layer, and based on any two subgrid nodes in the current generation of subgrids i With grid j ;

[0021] Then get the subgrid node grid i The center point v i With the subgrid node grid j The center point v j The Euclidean distance between them is used as the subgrid node grid i With the subgrid node grid j The grid node base distance between them is expressed as:

[0022] referDist(grid i ,grid j )=euclideanDist(v i ,v j )

[0023] Among them, Dist(grid i ,grid j ) represents the subgrid node gridi With the subgrid node grid j The grid node base distance between them; Dist(v i ,v j ) represents the subgrid node grid i The center point v i With the subgrid node grid j The center point v j The Euclidean distance between

[0024] S142: The constructed road network hierarchical grid tree consists of non-leaf grids and leaf grids; and the leaf nodes of the leaf grids are defined as grid leaf , define the non-leaf nodes of the non-leaf grid as grid m ;

[0025] Get the leaf node grid leaf The border edge data is stored in the pre-established node edge collection grid leaf .BorderESet;

[0026] Define non-leaf node grid m The node collection is grid m .childSet, child distance matrix is ​​grid m .childDist, and set the child distance matrix grid m The value on the diagonal of .childDist is 0;

[0027] And pre-establish non-leaf node grid m The node edge set is grid m .BorderESet;

[0028] S143: Traverse the sub-grid nodes grid in sequence i Each border edge in the node edge set BorderESet And v s With v t Represents the nodes at both ends of each border edge;

[0029] Judgment node v s With node v t Is it a grid? m ;

[0030] S1431: If confirmed v s ,v t ∈grid m , and v s ∈grid i , vt ∈grid j ;

[0031] Among them grid i ,grid j ∈grid m .childSet, and i>j;

[0032] Then continue to judge node v s With node v t The Euclidean distance Dist(v s ,v t ) is smaller than the subgrid node grid i With grid j The Euclidean distance grid between m .childDist[grid i ][grid j ];

[0033] If it is less than, let grid m .childDist[grid i ][grid j ]=Dist(v s ,v t ) and store it in the node edge set as grid m .BorderESet;

[0034] If not less than, the subgrid node grid i With the subgrid node grid j The Euclidean distance grid between m .childDist[grid i ][grid j ]Store the node edge set as grid m .BorderESet;

[0035] S1432: If confirmed v s or Then the node v s With node v t and its corresponding border edge Add to the node edge collection grid m .BorderESet;

[0036] S1433: grid the obtained node edge set leaf .BorderESet and grid m .BorderESet is the distance set of subgrid nodes in the current generation of subgrids;

[0037] Then, the distance set grid.childDist of the sub-grid nodes grid of each generation of sub-grids in the initial road network hierarchical grid tree is obtained to obtain the final road network hierarchical grid tree.

[0038] Furthermore, the S2 specifically includes the following steps:

[0039] S21: adopting the heuristic sample selection strategy, selecting the heuristic sample set HeurSample at each level of the road network hierarchical grid tree;

[0040] S22: adopting the sample selection strategy based on landmarks, selecting the surface selection sample set LandSample at each level of the road network hierarchical grid tree;

[0041] S23: Obtain a sample training set according to the heuristic sample set HeurSample and the surface selection sample set LandSample.

[0042] Furthermore, S21 specifically includes the following steps:

[0043] S211: Determine the number of samples N1, N2, ... N selected at each level of the road network hierarchical grid tree L ,and L Indicates the number of layers of the road network hierarchical grid tree;

[0044] S212: For the lth layer, use the sub-grid distance matrix of the l-1th layer to calculate the distance between any two grids i With grid j The grid pair score, where l∈(2,L)

[0045] The grid pair score of the first layer is obtained by using the sub-grid distance matrix of the corresponding layer to obtain any two grids of this layer. i With grid j Grid pair score;

[0046] And the calculation formula of the grid pair score is

[0047] score(grid i ,grid j )=Dist(grid i ,grid j ) / referDist(grid i ,grid j )

[0048] Where: score(grid i ,grid j ) represents any two gridsi With grid j Grid score of Dist(grid i ,grid j ) represents any two grids i With grid j The road network distance between them; referDist(grid i ,grid j ) represents any two grids i With grid j The benchmark distance between

[0049] S213: Select the two grids with the largest grid pair scores m With grid n , and respectively from the grid m With grid n Select node v s With v t As vertices, to obtain heuristic samples (v s ,v t ,Dist(v s ,v t ));

[0050] And update the grid based on the grid score decay formula m With grid n The grid score score(grid m ,grid n );

[0051] And the grid pair score attenuation formula is

[0052] score(grid i ,grid j )=score(grid i ,grid j )*α

[0053] Where: α represents the attenuation factor;

[0054] S214: Update the number of layers l of the road network hierarchical grid tree to l=l+1, and repeat steps S212 to S213 until the number of layers l of the road network hierarchical grid tree reaches the Lth layer, and then obtain the heuristic sample set HeurSample of each layer of the road network hierarchical grid tree.

[0055] Further, S22 specifically includes the following steps:

[0056] S221: For the lth layer, traverse each grid in turn iThe grid nodes;

[0057] And according to the center point center(grid i ) and the preset grid node threshold will i Divided into t regions {C j};

[0058] And the center point center(grid i ) is obtained by

[0059] center(grid i )=((grid i .leftBottom[0]+grid i .rightUp[0]) / 2,(grid i .leftBottom[1]+g

[0060] rid i .rightUp[1]) / 2)

[0061] S222: According to each area C j Confirm the distance from the center point center(grid i )The farthest point grid node v i As a grid i landmark points;

[0062] And the landmark points of any two grids are combined in pairs to obtain surface selection sample pairs;

[0063] S223: Update the number of layers l of the road network hierarchical grid tree to l=l+1, and repeat steps S221 to S222 until the number of layers l of the road network hierarchical grid tree reaches the Lth layer, thereby obtaining the surface selection sample set LandSample of each layer of the road network hierarchical grid tree.

[0064] Furthermore, in S3, a multi-vector based hierarchical representation vector model is constructed according to the hierarchical grid tree of the road network, specifically including a representation vector module and an embedding vector module of the road network vertices;

[0065] The representation vector module is used to represent each grid of the road network hierarchical grid tree i Use an n-dimensional representation vector, denoted as rev(grid i ), and at the same time, the road network node v in the road network hierarchical grid tree i The representation vector of is denoted as rev(v)={rev (1) (v i ),rev (2) (v i ),…,rev(m) (v i )};

[0066] The embedding vector module of the road network vertex is used to embed a given road network node v i The embedding vector of a road network vertex v in is represented as emv (m) (v), whose expression is

[0067]

[0068] Where: m represents the number of node representation vectors; rep(grid j ) represents the representation vector of the ancestor grid of the road network vertex v; rep (m) (v) represents the representation vector of the road network vertex v itself.

[0069] Furthermore, the calculation formula of the Manhattan distance between the embedding vectors of any two road network vertices in S4 is:

[0070] aDist(v s ,v t )=||em (m) (v s )-em (m) (v t )||1, m=min(flag[v s ],flag[v t ])

[0071] Where: aDist(v s ,v t ) represents the Manhattan distance of the embedded vectors of any two road network vertices, that is, the shortest road network estimated distance; em (m) (v s ) represents node v s Embedding vector of (m) (v t )Node v t Embedding vector of flag[v s ] represents node v s The number of representation vectors after training; flag[v t ] represents node v t The number of representation vectors after training.

[0072] Beneficial effects: The present invention provides a method for estimating the shortest road network distance based on a learning model, which solves the problem of low computational efficiency of existing traditional algorithms in the face of massive data. The present invention constructs a road network hierarchical grid tree about the road network node map, and by fully considering the hierarchical structure information of the road network, the shortest path is no longer pre-queried, so that the calculation speed is faster; based on the heuristic sampling strategy and the landmark-based sample selection strategy, a sample training set about the road network hierarchical grid tree is obtained, and the embedding vector of each vertex in the road network node map is obtained according to the hierarchical representation vector model trained based on the sample training set. In order to make the vertices in the road network fit as much as possible in the vector space, the present invention proposes a hierarchical representation vector model, so that the learning stage converges faster and the performance is better. In addition, a multi-vector method is also adopted to add supplementary representation vectors for unstable vertices, so that each vertex can be trained and learned using different representation vectors according to different samples. The present invention embeds each node in the road network into a d-dimensional space, and then represents each vertex as an embedding vector, and then uses the Manhattan distance calculation formula to approximate the shortest distance based on the two node embedding vectors. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0074] Figure 1 A flow chart of the shortest path network distance estimation method based on a learning model of the present invention;

[0075] Figure 2 This is a core flow chart of the shortest path network distance estimation method based on the learning model in this embodiment;

[0076] Figure 3 This is a schematic diagram applicable to the taxi-hailing software of the present invention in this embodiment;

[0077] Figure 4 A schematic diagram of a data set used when embedding a vector to calculate the shortest path network estimated distance between two points in this embodiment;

[0078] Figure 5 A schematic diagram of a hierarchical grid tree of a road network for constructing a road network node map in this embodiment;

[0079] Figure 6 In this embodiment, the corresponding Figure 4 Schematic diagram of the child distance matrix of the corresponding node in the grid tree;

[0080] Figure 7 A schematic diagram of selecting first-layer training samples of a grid tree according to the landmark-based sample selection method in this embodiment;

[0081] Figure 8 In this embodiment, the corresponding Figure 4 Schematic diagram of the multi-vector based hierarchical embedding model constructed by grid tree. DETAILED DESCRIPTION

[0082] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0083] This embodiment provides a method for estimating the shortest path network distance based on a learning model. Figure 1 to Figure 2 As shown, the specific steps include:

[0084] S1: Construct a hierarchical grid tree of road network nodes map;

[0085] The specific steps include:

[0086] S11: define the current root node of the initial road network structure, obtain the initial road network structure according to the road network node map G based on the current root node, and store each grid node grid of the initial road network structure into the set root.Vset;

[0087] Specifically, an edge e in the initial network structure is defined as e=<sourse,target,distance,lane,inEdges,outEdeges> , where source represents the source node; target represents the target node; distance represents the distance length; lane represents the number of lanes; inEdges represents the set of incoming edges of e, that is, e.source = e'.target (e'∈inEdges); outEdges represents the set of outgoing edges of e, that is, e.target = e".source (e"∈outEdges); and the grid tree is a network structure composed of non-leaf grids and leaf grids. It is a grid tree structure from top to bottom and can be expressed as (root, t, L), where root is the root node of the grid tree; t is the threshold value of the number of leaf grid road network nodes, and the number of road network vertices in all leaf grids is not allowed to exceed t; L is the level of the grid tree, where the nodes of the first L-1 layers are grid nodes, and the nodes of the bottom L layers are road network vertices stored in the leaf grids;

[0088] S12: According to the set root.Vset, the grid node grid in the road network node map is divided into a number of primary sub-grids in a top-down recursive manner, and its grid node set is defined as {childgridi};

[0089] S13: Take each first-generation sub-grid as the current initial road network structure, and repeat step S12 to obtain the next-generation sub-grid, until the number of grid vertices in the grid node set of the next-generation sub-grid is less than the preset grid vertex threshold, i.e., grid i .Vset.size <t;

[0090] Then, an initial road network hierarchical grid tree about the road network node map is obtained;

[0091] S14: Based on the distance set calculation strategy, from the bottom to the top of the initial road network hierarchical grid tree, the distance set grid.childDist of the sub-grid node grid of each generation of sub-grids is obtained layer by layer, and then the final road network hierarchical grid tree is obtained;

[0092] Wherein, childDist represents a subgrid distance matrix, and the subgrid distance matrix includes a lower triangular matrix for storing the shortest path network distances between subgrids, and an upper triangular matrix for storing the subgrid node reference distances between subgrids;

[0093] In a specific embodiment, the S14 specifically includes the following steps:

[0094] S141: Obtain the subgrid nodes of each generation of subgrids in the initial road network hierarchical grid tree layer by layer, and based on any two subgrid nodes in the current generation of subgrids i With grid j ;

[0095] Then get the subgrid node grid i The center point v i With the subgrid node grid j The center point v j The Euclidean distance between them is used as the subgrid node grid i With the subgrid node grid j The grid node base distance between them is expressed as:

[0096] referDist(grid i ,grid j )=euclideanDist(v i ,v j )

[0097] Among them, Dist(grid i ,grid j ) represents the subgrid node grid i With the subgrid node grid j The grid node base distance between them; Dist(v i ,v j ) represents the subgrid node grid i The center point v i With the subgrid node grid j The center point v j The Euclidean distance between

[0098] S142: The constructed road network hierarchical grid tree consists of non-leaf grids and leaf grids; and the leaf nodes of the leaf grids are defined as grid leaf , define the non-leaf nodes of the non-leaf grid as grid m ;

[0099] Get the leaf node grid leaf The border edge data is stored in the pre-established node edge collection grid leaf .BorderESet;

[0100] Define non-leaf node grid m The node collection is grid m .childSet, child distance matrix is ​​grid m .childDist, and set the child distance matrix grid m The value on the diagonal of .childDist is 0;

[0101] And pre-establish non-leaf node grid m The node edge set is grid m .BorderESet;

[0102] S143: Traverse the sub-grid nodes grid in sequence i Each border edge in the node edge set BorderESet And v s With v t Represents the nodes at both ends of each border edge;

[0103] Judgment node v s With node v t Is it a grid? m ;

[0104] S1431: If v is confirmed s ,v t ∈gridm , and v s ∈grid i , v t ∈grid j ;

[0105] Among them grid i ,grid j ∈grid m .childSet, and i>j;

[0106] Then continue to judge node v s With node v t The Euclidean distance Dist(v s ,v t ) is smaller than the subgrid node grid i With grid j The Euclidean distance grid between m .childDist[grid i ][grid j ];

[0107] If it is less than, let grid m .childDist[grid i ][grid j ]=Dist(v s ,v t ) and store it in the node edge set as grid m .BorderESet;

[0108] If not less than, the subgrid node grid i With the subgrid node grid j The Euclidean distance grid between m .childDist[grid i ][grid j ]Store the node edge set as grid m .BorderESet;

[0109] S1432: If confirmed v s or Then the node v s With node v t and its corresponding border edge Add to the node edge collection grid m .BorderESet;

[0110] S1433: grid the obtained node edge set leaf .BorderESet and gridm .BorderESet is the distance set of subgrid nodes in the current generation of subgrids;

[0111] Then, the distance set grid.childDist of the sub-grid nodes grid of each generation of sub-grids in the initial road network hierarchical grid tree is obtained to obtain the final road network hierarchical grid tree.

[0112] In this embodiment, since the road network G only contains the point set and edge set of the road network, the structural information of the road network is not easy to show. Therefore, this embodiment needs to prioritize the division of the road network G and build a grid tree structure to better capture its hierarchical structure information. The grid tree is divided in a top-down manner to divide each grid node, and a bottom-up manner is used to obtain the child distance matrix grid.childDist of each intermediate node grid. Figure 5 For Figure 4 The data set is divided from top to bottom to form a hierarchical grid tree, in which the grid nodes are divided into leaf grids and non-leaf grids. Non-leaf grid nodes have child distance matrices, while leaf grid nodes do not. Figure 6 for Figure 5 The child distance matrix of the corresponding node in the grid tree, for example, calculate the grid 00 Child distance matrix grid 00 .childDist,grid 00 The value on the diagonal of .childDist is 0, grid 00 .childDist 上三角 ={(grid 000 ,grid 001 ,0.125),(grid 000 ,grid 002 , ), (grid 001 ,grid 002 ,0.125)}. For grid 00 Child nodes of grid 000 、grid 001 and grid 002 , process their BorderESets in turn, for example, grid 000 .BorderESet={(v 14 ,v 21 ,0.13),(v 14 ,v 16 ,0.3)}, for (v 14 ,v 21 ,0.13), and v 14 ∈grid 000, v 21 ∈grid 002 , then grid 00 .childDis 下三角 [grid 002 ][grid 000 ]=0.13; for (v 14 ,v 16 ,0.3), where Then (v 14 ,v 16 ,0.3) Add to grid 00 .BorderESet. And so on, we finally get grid 00 .childDist.

[0113] S2: Based on the heuristic sampling strategy and the landmark-based sample selection strategy, training samples are selected from any layer of the road network hierarchical grid tree to obtain a sample training set;

[0114] The specific steps include:

[0115] S21: Adopting the heuristic sample selection strategy, select the heuristic sample set HeurSample = {HeurSample l};

[0116] In a specific embodiment, S21 specifically includes the following steps:

[0117] S211: Determine the number of samples N1, N2, ... N selected at each level of the road network hierarchical grid tree L , and L represents the number of layers of the road network hierarchical grid tree;

[0118] S212: For the lth layer, use the sub-grid distance matrix of the l-1th layer to calculate the distance between any two grids i With grid j , where l∈(2, L), and the grid pair score of the first layer, the sub-grid distance matrix of the corresponding layer is used to obtain any two grids of the layer. i With grid j Grid pair score;

[0119] And the calculation formula of the grid pair score is

[0120] score(grid i ,grid j )=Dist(grid i ,grid j ) / referDist(grid i ,gridj )

[0121] Where: score(grid i ,grid j ) represents any two grids i With grid j Grid score of Dist(grid i ,grid j ) represents any two grids i With grid j The road network distance between them; referDist(grid i ,grid j ) represents any two grids i With grid j The benchmark distance between

[0122] S213: Select the two grids with the largest grid pair scores m With grid n , and respectively from the grid m With grid n Select node v s With v t As vertices, to obtain heuristic samples (v s ,v t ,Dist(v s ,v t ));

[0123] And update the grid based on the grid score decay formula m With grid n The grid score score(grid m ,grid n );

[0124] This embodiment is to avoid repeatedly selecting the same two grid nodes each time a grid pair is selected. i and grid j , the present invention uses the attenuation factor α to reduce the grid pair scores of two grid nodes. i and grid j Each time it is selected, score(grid i ,grid j ) needs to be updated to score(grid i ,grid j )*α, and the grid pair score attenuation formula is

[0125] score(grid i,grid j )=score(grid i ,grid j )*α

[0126] Where: α represents the attenuation factor;

[0127] Repeat this step until N l For heuristic samples;

[0128] S214: Update the number of layers l of the road network hierarchical grid tree to l=l+1, and repeat steps S212 to S213 until the number of layers l of the road network hierarchical grid tree reaches the Lth layer, and then obtain the heuristic sample set HeurSample of each layer of the road network hierarchical grid tree.

[0129] S22: Using the landmark-based sample selection strategy, select the surface sample set LandSample = {LandSample l};

[0130] In a specific embodiment, S22 specifically includes the following steps:

[0131] S221: For the lth layer, traverse each grid in turn i The grid nodes;

[0132] And according to the center point center(grid i ) and the preset grid node threshold will i Divided into t regions {C j};

[0133] And the center point center(grid i ) is obtained by

[0134] center(grid i )=((grid i .leftBottom[0]+grid i .rightUp[0]) / 2,(grid i .leftBottom[1]+g

[0135] rid i .rightUp[1]) / 2)

[0136] Where (grid i .leftBottom[0] represents the grid i The horizontal coordinate of the lower left corner point; grid i.rightUp[0] represents the grid i The horizontal coordinate of the upper right corner point; grid i .leftBottom[1] represents the grid j The vertical coordinate of the lower left corner; grid i .rightUp[1] represents the grid j The vertical coordinate of the upper right corner point;

[0137] S222: For each region C j Confirm the distance from the center point center(grid i )The farthest point grid node v i As a grid i landmark points;

[0138] And the landmark points of any two grids are combined in pairs to obtain surface selection sample pairs;

[0139] S223: Update the number of layers l of the road network hierarchical grid tree to l=l+1, and repeat steps S221 to S222 until the number of layers l of the road network hierarchical grid tree reaches the Lth layer, thereby obtaining the surface selection sample set LandSample of each layer of the road network hierarchical grid tree.

[0140] S23: Summarize the heuristic sample set HeurSample and the surface selected sample set LandSample to obtain the sample training set Sample = {Sample l}.

[0141] After step S1, this embodiment uses the sampling algorithm to select training samples for each level of the grid tree through the grid tree index that has been obtained. Since sample selection is a crucial link, it will directly affect the performance and generalization ability of road network vertex embedding. Therefore, it is necessary to select a suitable sample selection method. Since the Euclidean distance can reflect the road network distance to a certain extent, there will always be some special vertex pairs whose Euclidean distance is much smaller than the actual road network distance. If these special vertex pairs are not taken into account during training, it will affect the overall embedding performance. Therefore, the present invention adopts a heuristic sample selection method to select samples whose road network distance is much larger than the Euclidean distance; the training samples selected using the landmark-based sample selection method are evenly distributed in the entire road network, and can well represent the entire road network and most of its vertex pairs, so the purpose of training an excellent model with a small number of samples can be achieved.

[0142] If targeted Figure 5The heuristic sample selection method is used to select the training samples of the first layer. When selecting the samples of the first layer, we must first traverse the root child distance matrix of the 0th layer, and calculate the grid pair scores between any grids among grid0, grid1, grid2 and grid3 according to root.childDist and the grid pair score calculation formula. Among them, score(grid0,grid1)=2.24 is the maximum value, so the grid pair grid0 and grid1 are selected in the first layer. Next, the attenuation factor α=0.8 is set, and the score(grid0,grid1) is updated to 2.24*0.8=1.78 according to the grid pair score attenuation formula to reduce the probability of the grid pair being selected next time. Then select the leaf grid grid closest to grid1 from grid0 02 , select the leaf grid closest to grid0 from grid1 13 , randomly from the grid 02 and grid 13 The road network vertices are selected to form samples (v 28 ,v2,1.7). Repeat this process to select four samples in the first layer, select different grid pairs each time, and finally select four samples as {(v 28 ,v2,1.7),(v 12 ,v5,1.32),(v 11 ,v 16 ,1.49),(v 24 ,v5,0.94)}.

[0143] like Figure 7 For Figure 5 The process of selecting the training samples of the first layer of the grid tree using the landmark-based sample selection method. In the first layer, the grid tree has four nodes, grid0, grid1, grid2, and grid3. For grid0, use the center point (0.25, 0.25) and the region division number threshold t = 4 to divide grid0 into four regions: C0, C1, C2, and C3. And select the vertex farthest from (0.25, 0.25) from these four regions as the landmark point, and the landmark point of grid0 is obtained as LandmarkSet(grid0) = {v3, v 28 ,v 29 ,v 16 Repeat the above process, the landmark points of grid1 are LandmarkSet(grid1)={v2,v8,v1,v9}, and the landmark points of grid2 are LandmarkSet(grid2)={v 26 ,v 24 ,v 30,v 23}, the landmark points of grid3 are LandmarkSet(grid3)={v 11 ,v 12 ,}. Finally, the landmarks of grid0, grid1, grid2, and grid3 are combined in pairs to form the sample set sample1 of the first layer of the grid tree. For example, the landmarks of grid1 and grid3 are combined in pairs to obtain the sample {(v2,v 11 ,1.79),(v2,v 12 ,2.12),(v8,v 11 ,1.45),(v8,v 12 ,1.78),(v1,v 11 ,2.04),(v1,v 12 ,2.37),(v9,v 11 ,1.78),(v9,v 12 ,2.11)}.

[0144] S3: Construct a multi-vector based hierarchical representation vector model according to the road network hierarchical grid tree;

[0145] The constructed multi-vector based hierarchical representation vector model includes a representation vector module and an embedding vector module of road network vertices;

[0146] The representation vector module is used to represent each grid of the road network hierarchical grid tree i Use an n-dimensional representation vector, denoted as rev(grid i ), and at the same time, the road network node v in the road network hierarchical grid tree i The representation vector is denoted as rev(v)={rev (1) (v i ),rev (2) (v i ),…,rev (m) (v i )};

[0147] The embedding vector module of the road network vertex is used to embed a given road network node v i The embedding vector of a road network vertex v in the vector is denoted as emv (m) (v), whose expression is

[0148]

[0149] Where: m represents the number of node representation vectors; rep(grid j ) represents the representation vector of the ancestor grid of the road network vertex v; rep (m) (v) represents the representation vector of the road network vertex v itself;

[0150] And according to the hierarchical representation vector model trained based on the sample training set, the embedding vector of each vertex in the road network node map is obtained, that is, the hierarchical representation vector model is trained, and finally the embedding vector emv of each vertex v in the road network is obtained (m) (v);

[0151] The training process of the hierarchical representation vector model includes a hierarchical training stage and a multi-vector training stage;

[0152] In the hierarchical training stage: using the training sample Sample obtained in step S2, the representation vector of the ancestor node of each layer of the road network vertex and the first representation vector of the vertex itself are updated;

[0153] Hierarchical training phase: Based on the hierarchical structure of the road network, the representation vector is learned by layer-by-layer training (a total of L steps), that is, starting from the first layer of the grid tree, training from top to bottom, by adjusting the learning rate α of each level l after each step lev l (lev) =α0 / (abs(l-lev)+1) to achieve this goal, α0 represents the baseline learning rate; and in the training process of each layer, for each heuristic training sample (v s ,v t ,Dist(v s ,v t )) and calculate v s With v t The loss function is expressed as

[0154] loss = (aDist(v s ,v t )-Dist(v s ,v t )) 2

[0155] where aDist(v s ,v t ) indicates v s With v t The approximate road network distance between s ,v t ) indicates v s With v t The actual road network distance between them;

[0156] Then the stochastic gradient descent algorithm (SGD) is used to implement v s and v t The representation vector of each layer of ancestor nodes and its own first representation vector are updated. The formula of the stochastic gradient descent algorithm is as follows:

[0157]

[0158] where a l Represents a grid node grid j The learning rate of the layer l; a L Represents the road network vertex v i The learning rate of the bottom L layers;

[0159] The multi-vector training stage: In each training round, for each training sample (v s ,v t ,Dist(v s ,v t )) and calculate v s With v t The loss function is then implemented by the stochastic gradient descent algorithm (SGD) for only v s and v t The mth representation vector of itself is updated; when the training reaches a fixed number of iterations, each road network vertex v is saved i The mth representation vector rev (m) (v i ), then find all the underfitting samples UnfitS in the training samples, and for the road network vertices v in UnfitS j The multi-vector flag flag[v j ] plus 1, and put the underfitting sample UnfitS into the next round of training; repeat the above process until there is no underfitting sample in a round of training;

[0160] Multi-vector flag: For each road network vertex v, a multi-vector flag flag[v] is given. The multi-vector flag flag[v] means that after training, the road network vertex v has flag[v] representation vectors, and accordingly it has flag[v] embedding vectors;

[0161] Step S3 in this embodiment is mainly to train the representation vectors of the nodes of each layer of the grid tree after obtaining the training sample Sample. The hierarchical training stage is to train the representation vectors of the nodes of each layer of the grid tree. If the representation vectors of these different layers are trained at the same time, the representation vectors of each layer are difficult to converge. Therefore, the representation vectors of the nodes of each layer are trained layer by layer in a top-down manner. Since there will always be some vertices that are under-fitted after the hierarchical training, it is necessary to perform multi-vector training on these under-fitting vertices, aiming to train the supplementary representation vectors of these under-fitting vertices themselves. After the training is completed, the embedded vector of the vertex can be obtained based on the representation vector of the vertex's ancestor node and its own representation vector.

[0162] by Figure 8 As an example, the update process of the representation vector is given below. Assume α0 = 0.01, and the learning rate of each layer in the first step is α1 (1) =0.01,α2 (1) =0.005,α3 (1) =0.0033,α4 (1) =0.0025, so the above learning rates are used to represent the ancestor nodes of v0, rev(grid1), rev(grid 10 )、rev(grid 100 ) and its own m-th representation vector rev (m) (v0) is updated; similarly, the update of the representation vector of v0 is also the same. For example, the ancestor node of v0 anc(v0) = {grid 100 ,grid 10 ,grid1},v 15 Ancestor node anc(v 15 )={grid 001 ,grid 00 ,grid0}, the first embedding vector of v0 is equal to the sum of its ancestor node and its own first representation vector: emv (m) (v0) = rev(grid1) + rev(grid 10 )+rev(grid 100 )+rev (m) (v0)=(-1.62,-0.46,-1.58), similarly v 15 The first embedding vector is emv (m) (v 15 )=rev(grid0)+rev(grid 00 )+rev(grid 001 )+rev (m) (v 15 )=(-1.62,-0.46,-1.58).

[0163] S4: By calculating the Manhattan distance of the embedded vectors of any two road network vertices, the shortest estimated distance between these two road network nodes is determined, and the calculation formula of the Manhattan distance of the embedded vectors of any two road network nodes is:

[0164] aDist(v s ,v t )=||em (m) (v s )-em (m) (v t )||1, m=min(flag[v s],flag[v t ])

[0165] Where: aDist(v s ,v t ) represents the Manhattan distance of the embedded vectors of any two road network vertices, that is, the shortest road network estimated distance; em (m) (v s ) represents node v s Embedding vector of (m) (v t )Node v t Embedding vector of flag[v s ] represents node v s The number of representation vectors after training; flag[v t ] represents node v t The number of representation vectors after training.

[0166] like Figure 3 The figure is a schematic diagram of the present invention applicable to a taxi-hailing software, as listed in this embodiment.

[0167] like Figure 4 The following is a diagram of the dataset used to calculate the shortest path network distance between two points using embedded vectors. Figure 4 As shown in the figure, the road network graph G consists of 31 nodes {v0, ..., v 30}, the edge weight of the road network G represents the distance of the actual road network. Take the taxi app as an example: suppose the passenger is in v 22 This location initiates a taxi request, v 22 There are three candidate vehicles nearby, located at v 10 、v 14 and v 19 At this time, we need to quickly calculate the 22 To v 10 、v 14 and v 19 The shortest path distance is to assign the passenger to the nearest car. Using the traditional shortest path distance calculation algorithm, first, we need to calculate the distance from v 22 to v 10 The path with the shortest distance among the many paths is recorded as path1= <v 22 ,v 17 ,v 24 ,v 10 >, the distance of path1 is 1; and so on, from v 22 to v 14 The shortest path is path1= <v 22 ,v 25 ,v 28,v 27 ,v 21 ,v 14 >, the distance of path2 is 0.89, from v 22 to v 19 The shortest path is path3= <v 22 ,v 17 ,v 18 ,v 19 >, the distance of path3 is 0.83; comparing the three shortest paths of path1, path2 and path3, path3 is the shortest, so the passenger is assigned to the route located at v 19 However, this method is too time-consuming and cannot allocate the most suitable vehicle to passengers in a very short time for a large number of requests. The shortest path network distance estimation method proposed in the present invention can quickly calculate these massive user requests. For example, the above four points v 22 、v 10 、v 14 and v 19 After training, their three-dimensional embedding vectors can be obtained as follows: emv(v 22 )=(0.2,0.5,0.3),emv(v 10 )=(0.7,0.7,0.59),emv(v 14 )=(0.9,0.59,0.41) and emv(v 19 )=(0.6,0.83,0.38). Then, according to the Manhattan distance calculation formula, we can quickly get the 22 to v 10 、v 14 and v 19 The estimated shortest path network distance is aDist(v 22 ,v 22 )=0.99,aDist(v 22 ,v 14 )=0.99,aDist(v 22 ,v 19 )=0.81, so the passenger is assigned to 19 Compared with the traditional algorithm, the shortest road network distance estimation method proposed in the present invention is much faster in calculating the shortest distance. It mainly uses the machine learning method to train the embedding vector of each road network vertex, and then the shortest road network distance between two points can be quickly calculated based on the Manhattan distance.

[0168] by Figure 8 Taking the hierarchical vector embedding model as an example, the following is a calculation of v0 and v 15Example of road network distance. The representation vector of v0 in the first layer of the ancestor grid1 is rev(grid1)=(-0.66,-0.49,-1.23), and the representation vector of v0 in the second layer of the ancestor grid1 is rev(grid1)=(-0.66,-0.49,-1.23). 10 The representation vector is rev(grid 10 )=(-0.81,0.30,0.10), in the ancestor grid of the third layer 100 The representation vector is rev(grid 100 )=(-0.52,-0.46,-0.16), v0 itself has two representation vectors rev (1) (v0)=(0.37,0.19,-0.29), rev (2) (v0) = (-0.13, 0.28, -0.17). Then we can get the two embedding vectors of v0 as emv (1) (v0)=(-1.62,-0.46,-1.28),emv (2) (v0)=(-2.12,-0.37,-1.46). Similarly, v 15 There is an embedding vector emv (1) (v 15 )=(-1.41,0.88,-0.69). Next, since flag[v0]=2, flag[v0]=1, m=1, use v0 and v 15 The first embedding vector is used to calculate the approximate distance aDist(v0,v 15 )=2.44, the real distance is Dist(v0,v 15 )=2.4.

[0169] This embodiment discloses a learning-based shortest road network distance estimation algorithm, which solves the problem of low computational efficiency of existing traditional algorithms in the face of massive data. At present, the existing research mainly calculates the shortest path first when calculating the shortest road network distance, and then calculates the shortest distance based on the shortest path. According to this idea, the calculation of the shortest distance is converted into the calculation of the shortest path, which greatly affects the speed of calculation. The present invention embeds each node in the road network into a d-dimensional space, and then represents each vertex as an embedded vector, and then uses the Manhattan distance calculation formula to approximate the shortest distance based on the two node embedding vectors. Compared with the existing traditional algorithms, the present invention fully considers the hierarchical structure information of the road network, no longer pre-queries the shortest path, but embeds the two-dimensional vertices (longitude and latitude) in the road network into a multi-dimensional vector space, so that the calculation speed is faster. In order to make the vertices in the road network fit as much as possible in the vector space, the present invention proposes a hierarchical embedding model, so that the learning stage converges faster and the performance is better. In addition, a multi-vector method is adopted to add supplementary representation vectors for unstable vertices, so that each vertex can be trained and learned using different representation vectors according to different samples.

[0170] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for estimating the shortest path network distance based on a learning model, characterized in that: The specific steps include: S1: Construct a hierarchical grid tree of road network nodes map; S2: Based on the heuristic sampling strategy and the landmark-based sample selection strategy, training samples are selected from any layer of the road network hierarchical grid tree to obtain a sample training set; S3: Construct a multi-vector based hierarchical representation vector model according to the road network hierarchical grid tree; And according to the hierarchical representation vector model trained based on the sample training set, the embedding vector of each road network vertex in the road network node map is obtained; The number of layers of the road network hierarchical grid tree is defined as L, and the nodes in the first L-1 layers of the road network hierarchical grid tree are used as road network nodes, and the nodes in the bottom L layers are used as road network vertices; S4: Determine the shortest estimated distance between any two road network nodes by calculating the Manhattan distance of the embedded vectors of any two road network vertices.

2. The method for estimating the shortest path network distance based on a learning model according to claim 1, characterized in that: The S1 specifically includes the following steps: S11: defining a current root node of the initial road network structure, and based on the current root node, obtaining the initial road network structure according to the road network node map, and storing each grid node grid of the initial road network structure into the set root.Vset; S12: According to the set root.Vset, the grid node grid in the road network node map is divided into a number of primary sub-grids in a top-down recursive manner, and its grid node set is defined as {childgridi}; S13: taking each first-generation sub-grid as the current initial road network structure, and repeatedly executing step S12 to obtain a next-generation sub-grid, until the number of grid vertices in the grid node set of the next-generation sub-grid is less than a preset grid vertex threshold; Then, an initial road network hierarchical grid tree about the road network node map is obtained; S14: Based on the distance set calculation strategy, from the bottom to the top of the initial road network hierarchical grid tree, the distance set grid.childDist of the sub-grid node grid of each generation of sub-grids is obtained layer by layer, and then the final road network hierarchical grid tree is obtained; Among them, childDist represents a sub-grid distance matrix, and the sub-grid distance matrix includes a lower triangular matrix for storing the shortest path network distances between sub-grids, and an upper triangular matrix for storing sub-grid node reference distances between sub-grids.

3. The method for estimating the shortest path network distance based on a learning model according to claim 2, characterized in that: The S14 specifically includes the following steps: S141: Obtain the subgrid nodes of each generation of subgrids in the initial road network hierarchical grid tree layer by layer, and based on any two subgrid nodes in the current generation of subgrids i With grid j ; Get the subgrid node grid i The center point v i With the subgrid node grid j The center point v j The Euclidean distance between them is used as the subgrid node grid i With the subgrid node grid j The grid node base distance between them is expressed as: referDist(grid i ,grid j )=euclideanDist(v i ,v j ) Among them, Dist(grid i ,grid j ) represents the subgrid node grid i With the subgrid node grid j The grid node base distance between them; Dist(v i ,v j ) represents the subgrid node grid i The center point v i With the subgrid node grid j The center point v j The Euclidean distance between S142: The constructed road network hierarchical grid tree consists of non-leaf grids and leaf grids; and the leaf nodes of the leaf grids are defined as grid leaf , define the non-leaf nodes of the non-leaf grid as grid m ; Get the leaf node grid leaf The border edge data is stored in the pre-established node edge collection grid leaf .BorderESet; Define non-leaf node grid m The node collection is grid m .childSet, child distance matrix is ​​grid m .childDist, and set the child distance matrix grid m The value on the diagonal of .childDist is 0; And pre-establish non-leaf node grid m The node edge set is grid m .BorderESet; S143: Traverse the sub-grid nodes grid in sequence i Each border edge in the node edge set BorderESet And v s With v t Represents the nodes at both ends of each border edge; Judgment node v s With node v t Is it a grid? m ; S1431: If confirmed v s ,v t ∈grid m , and v s ∈grid i , v t ∈grid j ; Among them grid i ,grid j ∈grid m .childSet, and i>j; Then continue to judge node v s With node v t The Euclidean distance Dist(v s ,v t ) is smaller than the subgrid node grid i With grid j The Euclidean distance grid between m .childDist[grid i ][grid j ]; If it is less than, let grid m .childDist[grid i ][grid j ]=Dist(v s ,v t ) and store it in the node edge set as grid m .BorderESet; If not less than, the subgrid node grid i With the subgrid node grid j The Euclidean distance grid between m .childDist[grid i ][grid j ]Store the node edge set as grid m .BorderESet; S1432: If confirmed v s or Then the node v s With node v t and its corresponding border edge Add to the node edge collection grid m .BorderESet; S1433: grid the obtained node edge set leaf .BorderESet and grid m .BorderESet is the distance set of subgrid nodes in the current generation of subgrids; Then, the distance set grid.childDist of the sub-grid nodes grid of each generation of sub-grids in the initial road network hierarchical grid tree is obtained to obtain the final road network hierarchical grid tree.

4. The method for estimating the shortest path network distance based on a learning model according to claim 3, characterized in that: The S2 specifically includes the following steps: S21: adopting the heuristic sample selection strategy, selecting the heuristic sample set HeurSample at each level of the road network hierarchical grid tree; S22: adopting the sample selection strategy based on landmarks, selecting the surface selection sample set LandSample at each level of the road network hierarchical grid tree; S23: Obtain a sample training set according to the heuristic sample set HeurSample and the surface selection sample set LandSample.

5. The method for estimating the shortest path network distance based on a learning model according to claim 4, characterized in that: S21 specifically includes the following steps: S211: Determine the number of samples N1, N2, ... N selected at each level of the road network hierarchical grid tree L ,and L Indicates the number of layers of the road network hierarchical grid tree; S212: For the lth layer, use the sub-grid distance matrix of the l-1th layer to calculate the distance between any two grids i With grid j The grid pair score of , where l∈(2,L); The grid pair score of the first layer is obtained by using the sub-grid distance matrix of the corresponding layer to obtain any two grids of this layer. i With grid j Grid pair score; And the calculation formula of the grid pair score corresponding to the lth layer is score(grid i ,grid j )=Dist(grid i ,grid j ) / referDist(grid i ,grid j ) Where: score(grid i ,grid j ) represents any two grids i With grid j Grid score of Dist(grid i ,grid j ) represents any two grids i With grid j The road network distance between them; referDist(grid i ,grid j ) represents any two grids i With grid j The benchmark distance between S213: Select the two grids with the largest grid pair scores m With grid n , and respectively from the grid m With grid n Select node v s With v t As vertices, to obtain heuristic samples (v s ,v t ,Dist(v s ,v t )); And update the grid based on the grid score decay formula m With grid n The grid score score(grid m ,grid n ); And the grid pair score attenuation formula is score(grid i ,grid j )=score(grid i ,grid j )*α Where: α represents the attenuation factor; S214: Update the number of layers of the road network hierarchical grid tree so that l=l+1, and repeat steps S212 to S213 until the number of layers l of the road network hierarchical grid tree reaches the Lth layer, and then obtain the heuristic sample set HeurSample of each level of the road network hierarchical grid tree.

6. The method for estimating the shortest path network distance based on a learning model according to claim 4, characterized in that: S22 specifically includes the following steps: S221: For the lth layer, traverse each grid in turn i Grid nodes; And according to the center point center(grid i ) and the preset grid node threshold will i Divided into t regions {C j }; And the center point center(grid i ) is obtained by center(grid i )=((grid i .leftBottom[0]+grid i .rightUp[0]) / 2,(grid i .leftBottom[1]+g laugh i .rightUp[1]) / 2) S222: According to each area C j Confirm the distance from the center point center(grid i )The farthest point grid node v i As a grid i landmark points; And the landmark points of any two grids are combined in pairs to obtain surface selection sample pairs; S223: Update the number of layers l of the road network hierarchical grid tree to l=l+1, and repeat steps S221 to S222 until the number of layers l of the road network hierarchical grid tree reaches the Lth layer, thereby obtaining the surface selection sample set LandSample of each layer of the road network hierarchical grid tree.

7. The method for estimating the shortest path network distance based on a learning model according to claim 4, characterized in that: In S3, a multi-vector based hierarchical representation vector model is constructed according to the hierarchical grid tree of the road network, specifically including a representation vector module and an embedding vector module of the road network vertices; The representation vector module is used to represent each grid of the road network hierarchical grid tree i Use an n-dimensional representation vector, denoted as rev(grid i ), and at the same time, the road network node v in the road network hierarchical grid tree i The representation vector of is denoted as rev(v)={rev (1) (v i ),rev (2) (v i ),…,rev (m) (v i )}; The embedding vector module of the road network vertex is used to embed a given road network node v i The embedding vector of a road network vertex v in is represented as emv (m) (v), whose expression is Where: m represents the number of node representation vectors; rep(grid j ) represents the representation vector of the ancestor grid of the road network vertex v; rep (m) (v) represents the representation vector of the road network vertex v itself.

8. The method for estimating the shortest path network distance based on a learning model according to claim 7, characterized in that: The calculation formula of the Manhattan distance between the embedded vectors of any two road network vertices in S4 is: aDist(v s ,v t )=||em (m) (v s )-em (m) (v t )||1,m=min(flag[v s ],flag[v t ]) Where: aDist(v s ,v t ) represents the Manhattan distance of the embedded vectors of any two road network vertices, that is, the shortest road network estimated distance; em (m) (v s ) represents node v s Embedding vector of (m) (v t )Node v t Embedding vector of flag[v s ] represents node v s The number of representation vectors after training; flag[v t ] represents node v t The number of representation vectors after training.