Delivery resource recall method and device, electronic equipment and storage medium
By determining the polygon lattice in the geographical location and recall scope, the problem of low efficiency in querying distribution resources is solved, and the efficiency of resource recall and the saving of hardware resources is achieved.
Patent Information
- Application Number
- CN202411061292.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-11-15
AI Technical Summary
During the order life cycle of providing takeaway-related services, querying peripheral delivery resources (such as riders) is low, resulting in long resource query time and high hardware resource utilization.
By obtaining the geographical location information of the location and the preset recall range, determine the polygon lattice and obtain the distribution resources corresponding to the lattice to realize resource recall and reduce query time and hardware resource utilization.
It improves the query efficiency of distribution resource recall, reduces the number of hotkeys and processor utilization of the memory data storage system, and saves hardware resources.
Smart Images

Figure CN118966936A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent logistics technology, and in particular to a distribution resource recall method and device, electronic equipment and storage medium. Background Art
[0002] For local life that provides food delivery related services, obtaining surrounding delivery resources (such as riders, unmanned delivery vehicles, etc.) is a very important function in many links of the order life cycle, such as scheduling, dispatching, and forecasting. Taking the delivery resource as a rider as an example, for example, based on the merchant coordinates and the rider coordinates, query the riders within one kilometer, three kilometers, or five kilometers around the merchant coordinates; for example, based on the customer coordinates and the rider coordinates, query the riders within one kilometer, three kilometers, or five kilometers around the customer coordinates, and so on. Due to the huge amount of data on merchants, customers, and riders as a whole, this type of query often has a high QPS (Queries Per Second). How to improve query efficiency and save query resources has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] In view of the above problems, the present application is proposed to provide a distribution resource recall method and device, electronic device and storage medium that overcome the above problems or at least partially solve the above problems. The technical solution is as follows: In a first aspect, a distribution resource recall method is provided, comprising: Obtain geographic location information and preset recall ranges of one or more locations; For each location in the one or more locations, determining at least one polygonal grid corresponding to each location within the preset recall range according to the geographical location information of each location and the preset recall range; The distribution resources corresponding to the at least one polygonal grid are obtained and recalled as distribution resources at various locations.
[0004] In a possible implementation, for each location in the one or more locations, determining at least one polygonal grid corresponding to each location within the preset recall range according to the geographical location information of each location and the preset recall range includes: For each point in one or more locations, determine the polygonal grid to which each point belongs according to the geographical location information of each point; According to the polygonal grids to which each location belongs and the preset recall range, at least one polygonal grid corresponding to each location within the preset recall range is determined.
[0005] In a possible implementation, the method further includes: Obtain the type of capacity required for one or more locations; The obtaining of the distribution resource corresponding to the at least one polygonal grid and recalling the distribution resource at each location includes: The distribution resources corresponding to the at least one polygonal grid are obtained, and the distribution resources that meet the transportation capacity type required by each location are screened out and recalled as the distribution resources of each location.
[0006] In a possible implementation manner, the polygonal lattice includes a regular hexagonal lattice, and the method further includes: The Platonic stereographic projection is used to project the earth's spherical surface into a regular octahedron; The projected regular octahedron is covered with a regular hexagon of a first preset side length, and each covered regular hexagonal grid is encoded, wherein the first preset side length corresponds to a first regular hexagonal grid level; The projected regular octahedron is covered with a regular hexagon of a second preset side length, and each covered regular hexagonal grid is encoded, wherein the second preset side length corresponds to a second regular hexagonal grid level; The projected regular octahedron is covered with a regular hexagon of a third preset side length, and each covered regular hexagonal grid is encoded, wherein the third preset side length corresponds to a third regular hexagonal grid level; By analogy, the projected regular octahedron is covered with a regular hexagon of the Nth preset side length, and each covered regular hexagonal grid is encoded, wherein the Nth preset side length corresponds to the Nth regular hexagonal grid level, and N is a positive integer.
[0007] In a possible implementation, the method further includes: Get the current geographic location information of multiple delivery resources in the target area; According to the current geographical location information of the plurality of distribution resources, determining the regular hexagonal grid to which each distribution resource belongs at different regular hexagonal grid levels; According to the regular hexagonal grids to which each distribution resource belongs at different regular hexagonal grid levels, the target regular hexagonal grid level is determined.
[0008] In a possible implementation, after determining the target regular hexagonal grid level according to the regular hexagonal grids to which the respective distribution resources belong at different regular hexagonal grid levels, the method further includes: Get the current geographic location information of each delivery resource; Determine, according to the current geographical location information of each distribution resource, the regular hexagonal grid to which each distribution resource belongs under the target regular hexagonal grid level; The identification of each distribution resource, the current geographical location information, and the regular hexagonal grid to which it belongs are stored in association.
[0009] In a possible implementation, obtaining the distribution resource corresponding to the at least one polygonal grid and recalling it as the distribution resource of each location includes: According to the identification of each distribution resource stored in association, the current geographical location information, and the regular hexagonal grid to which it belongs, the distribution resource corresponding to the at least one polygonal grid is obtained and recalled as the distribution resource of each location.
[0010] In a possible implementation, the method further includes: Get the current attribute information of each distribution resource; The identification and current attribute information of each distribution resource are associated and stored.
[0011] In a possible implementation, the current attribute information includes one or more of capacity type, current time, geographic location accuracy, altitude, angle and speed.
[0012] In a second aspect, a distribution resource recall device is provided, comprising: A first acquisition unit, used to acquire geographic location information of one or more locations and a preset recall range; A determination unit, configured to determine, for each location in the one or more locations, at least one polygonal grid corresponding to each location within the preset recall range according to the geographical location information of each location and the preset recall range; The second acquisition unit is used to acquire the distribution resources corresponding to the at least one polygonal grid and recall them as distribution resources at various locations.
[0013] In a possible implementation manner, the determining unit is further configured to: For each point in one or more locations, determine the polygonal grid to which each point belongs according to the geographical location information of each point; According to the polygonal grids to which each location belongs and the preset recall range, at least one polygonal grid corresponding to each location within the preset recall range is determined.
[0014] In a possible implementation, the first acquisition unit is further used to: acquire the type of transportation capacity required by one or more locations; The second acquisition unit is further used to: acquire the distribution resources corresponding to the at least one polygonal grid, and screen out the distribution resources that meet the transportation capacity type required by each location as the distribution resources of each location for recall.
[0015] In a possible implementation, the polygonal lattice includes a regular hexagonal lattice, and the apparatus further includes a regular hexagonal lattice construction unit, which is used to: The Platonic stereographic projection is used to project the earth's spherical surface into a regular octahedron; The projected regular octahedron is covered with a regular hexagon of a first preset side length, and each covered regular hexagonal grid is encoded, wherein the first preset side length corresponds to a first regular hexagonal grid level; The projected regular octahedron is covered with a regular hexagon of a second preset side length, and each covered regular hexagonal grid is encoded, wherein the second preset side length corresponds to a second regular hexagonal grid level; The projected regular octahedron is covered with a regular hexagon of a third preset side length, and each covered regular hexagonal grid is encoded, wherein the third preset side length corresponds to a third regular hexagonal grid level; By analogy, the projected regular octahedron is covered with a regular hexagon of the Nth preset side length, and each covered regular hexagonal grid is encoded, wherein the Nth preset side length corresponds to the Nth regular hexagonal grid level, and N is a positive integer.
[0016] In a possible implementation, the device further includes a regular hexagonal grid level selection unit, which is used to: Get the current geographic location information of multiple delivery resources in the target area; According to the current geographical location information of the plurality of distribution resources, determining the regular hexagonal grid to which each distribution resource belongs at different regular hexagonal grid levels; According to the regular hexagonal grids to which each distribution resource belongs at different regular hexagonal grid levels, the target regular hexagonal grid level is determined.
[0017] In a possible implementation, the device further includes an association relationship establishing unit, configured to: Get the current geographic location information of each delivery resource; Determine, according to the current geographical location information of each distribution resource, the regular hexagonal grid to which each distribution resource belongs under the target regular hexagonal grid level; The identification of each distribution resource, the current geographical location information, and the regular hexagonal grid to which it belongs are stored in association.
[0018] In a possible implementation manner, the second acquiring unit is further configured to: According to the identification of each distribution resource stored in association, the current geographical location information, and the regular hexagonal grid to which it belongs, the distribution resource corresponding to the at least one polygonal grid is obtained and recalled as the distribution resource of each location.
[0019] In a possible implementation, the association relationship establishing unit is further used to: Get the current attribute information of each distribution resource; The identification and current attribute information of each distribution resource are associated and stored.
[0020] In a possible implementation, the current attribute information includes one or more of capacity type, current time, geographic location accuracy, altitude, angle and speed.
[0021] In a third aspect, an electronic device is provided, comprising a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute any one of the above-mentioned distribution resource recall methods.
[0022] In a fourth aspect, a storage medium is provided, wherein the storage medium stores a computer program, wherein the computer program is configured to execute any one of the above-mentioned distribution resource recall methods when running.
[0023] By means of the above technical scheme, the distribution resource recall method and device, electronic device and storage medium provided in the embodiment of the present application can obtain the geographic location information and preset recall range of one or more locations; for each location in the one or more locations, at least one polygonal grid corresponding to each location within the preset recall range is determined according to the geographic location information and preset recall range of each location; the distribution resource corresponding to at least one polygonal grid is obtained and recalled as the distribution resource of each location. It can be seen that the present embodiment groups the distribution resources based on polygonal grids, and by determining at least one polygonal grid corresponding to each location within the preset recall range, the distribution resource corresponding to at least one polygonal grid is obtained and recalled as the distribution resource of each location, which can reduce the query time of distribution resource recall and improve the query efficiency; and only the distribution resource corresponding to at least one polygonal grid is queried and obtained, and there is no need to query the distribution resources corresponding to all polygonal grids, which can reduce the number of hot keys of the memory data storage system, and at the same time reduce the processor utilization rate and overall container resource utilization rate of the memory data storage system, saving hardware resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0025] Figure 1 A flow chart of a distribution resource recall method provided in an embodiment of the present application is shown; Figure 2 A schematic diagram showing a distribution resource recall service framework provided in an embodiment of the present application is shown; Figure 3 A structural diagram of a distribution resource recall device provided in an embodiment of the present application is shown; Figure 4 A structural diagram of a distribution resource recall device provided in another embodiment of the present application is shown; Figure 5 A structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0026] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such use is interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the term "including" and its variants are to be interpreted as open-ended terms meaning "including but not limited to".
[0028] The present application embodiment provides a distribution resource recall method, such as Figure 1 As shown, the distribution resource recall method may include the following steps S101 to S103: Step S101, obtaining geographic location information of one or more locations and a preset recall range.
[0029] In this step, one or more locations may be a merchant's location, a customer's location, a smart cabinet's location, etc., which is not limited in this embodiment.
[0030] Geographic location information may be information that uniquely identifies a location in a geographic system, such as longitude and latitude.
[0031] The preset recall range can be determined according to actual needs, such as one kilometer, three kilometers or five kilometers, etc., and this embodiment does not limit this.
[0032] Step S102: for each location in the one or more locations, at least one polygonal grid corresponding to each location within the preset recall range is determined according to the geographical location information of each location and the preset recall range.
[0033] In this step, the polygonal grid divides the earth's spherical surface. Specifically, the earth's spherical surface can be projected into a regular octahedron using Plato's stereographic projection, and each face of the regular octahedron forms an equilateral triangle. Then, the projected regular octahedron is covered with polygons, that is, recursion is performed on the equilateral triangle and the polygonal grid is used to fill it. Then, each covered polygonal grid is encoded so that each polygonal grid has a geographical location range, such as a longitude and latitude range.
[0034] Therefore, for each location in one or more places, at least one polygonal grid corresponding to each location within the preset recall range can be determined among the multiple polygonal grids that divide the earth's surface or the multiple polygonal grids that divide the target area based on the geographical location information of each location and the preset recall range.
[0035] Step S103, obtaining the distribution resources corresponding to at least one polygonal grid and recalling them as distribution resources at each location.
[0036] In this step, a real-time association relationship is established between the polygonal grid and the distribution resources, so that the distribution resources corresponding to at least one polygonal grid can be obtained according to the association relationship and recalled as distribution resources for various locations.
[0037] This embodiment groups distribution resources based on polygonal grids, and obtains distribution resources corresponding to at least one polygonal grid by determining at least one polygonal grid corresponding to each location within a preset recall range. The distribution resources are recalled as distribution resources for each location, which can reduce the query time for distribution resource recall and improve query efficiency. In addition, only the distribution resources corresponding to at least one polygonal grid are queried and obtained, and there is no need to query the distribution resources corresponding to all polygonal grids. This can reduce the number of hot keys of the memory data storage system, and at the same time reduce the processor utilization and overall container resource utilization of the memory data storage system, thereby saving hardware resources.
[0038] In an embodiment of the present application, a possible implementation method is provided. In the above step S102, for each location in one or more locations, according to the geographical location information of each location and the preset recall range, at least one polygon grid corresponding to each location within the preset recall range is determined, which may specifically include the following steps A1 and A2: Step A1, for each point in one or more locations, determine the polygonal grid to which each point belongs according to the geographical location information of each point.
[0039] As mentioned above, each polygonal grid has a geographical location range, such as a longitude and latitude range. Therefore, the polygonal grid to which each location belongs can be determined based on the geographical location information of each location.
[0040] Step A2: determining at least one polygonal grid corresponding to each location within the preset recall range according to the polygonal grid to which each location belongs and the preset recall range.
[0041] In this embodiment, since each location is mapped to a specific polygonal grid, data management and indexing are simpler and clearer; during the search process, only a specific grid and its adjacent grids need to be focused on, which can quickly narrow the search range and reduce unnecessary calculations.
[0042] The embodiment of the present application provides a possible implementation method. Since there may be various types of transportation capacity of distribution resources, such as team, crowdsourcing, third party, etc.; and motorcycle, small truck, large truck, etc., this embodiment does not limit this, so this embodiment may also include the following steps B1: Step B1, obtaining the type of transportation capacity required for one or more locations.
[0043] In this step, each location can configure the type of capacity it needs, such as team, crowdsourcing, third party, etc.
[0044] Furthermore, the above step S103 obtains the distribution resource corresponding to at least one polygonal grid and recalls it as the distribution resource of each location, which may specifically include the following steps B2: Step B2, obtaining the distribution resources corresponding to at least one polygonal grid, and screening out the distribution resources that meet the transportation capacity type required by each location as the distribution resources of each location for recall.
[0045] This embodiment can more accurately match appropriate distribution resources by accurately locating the polygonal grid to which the location belongs and taking into account the type of transportation capacity required for the location, thereby improving the personalization of services and meeting the specific needs of customers.
[0046] A possible implementation method is provided in an embodiment of the present application. The polygonal grid mentioned above may include a regular hexagonal grid. This embodiment may also include the following steps C1 to C5: Step C1, projecting the earth's spherical surface into a regular octahedron using Plato's stereographic projection; Step C2, using a regular hexagon with a first preset side length to cover the projected regular octahedron, and encoding each covered regular hexagonal grid, wherein the first preset side length corresponds to a first regular hexagonal grid level; Step C3, using a regular hexagon with a second preset side length to cover the projected regular octahedron, and encoding each covered regular hexagonal grid, wherein the second preset side length corresponds to a second regular hexagonal grid level; Step C4, using a regular hexagon with a third preset side length to cover the projected regular octahedron, and encoding each covered regular hexagonal grid, wherein the third preset side length corresponds to a third regular hexagonal grid level; Step C5, and so on, use a regular hexagon with an Nth preset side length to cover the projected regular octahedron, and encode each covered regular hexagonal grid, wherein the Nth preset side length corresponds to the Nth regular hexagonal grid level, and N is a positive integer.
[0047] In this embodiment, under the Platonic stereographic projection, compared with traditional plane projection methods (such as Mercator projection), this method can reduce the area distortion of polar regions, thereby providing more uniform analysis accuracy at a global scale; since the coverage of regular hexagons has high symmetry and uniformity, it is convenient to use algorithms and computing models to process data, which can effectively reduce computing costs; and, by covering the regular octahedron with regular hexagons of different preset side lengths, multiple map grid levels of different resolutions can be created; in addition, by encoding each regular hexagonal grid, geographic data can be conveniently stored, retrieved and managed, and grid coding provides an effective way to locate and reference target areas on the earth's surface.
[0048] The embodiment of the present application provides a possible implementation method, which can select a suitable regular hexagonal grid level according to the distribution of delivery resources in the target area, that is, select a regular hexagon with a suitable side length to cover the projected regular octahedron, which can specifically include the following steps D1 to D3: Step D1, obtaining current geographical location information of multiple distribution resources in a target area.
[0049] Step D2, determining the regular hexagonal grid to which each distribution resource belongs at different regular hexagonal grid levels according to the current geographical location information of the plurality of distribution resources.
[0050] In this step, different regular hexagonal lattice levels may include a first regular hexagonal lattice level, a second regular hexagonal lattice level, a third regular hexagonal lattice level, an Nth regular hexagonal lattice level, where N is a positive integer, and so on, which is not limited in this embodiment.
[0051] Specifically, the regular hexagonal lattice to which each distribution resource belongs at the first regular hexagonal lattice level can be determined based on the current geographical location information of multiple distribution resources; the regular hexagonal lattice to which each distribution resource belongs at the second regular hexagonal lattice level can be determined based on the current geographical location information of multiple distribution resources; the regular hexagonal lattice to which each distribution resource belongs at the third regular hexagonal lattice level can be determined based on the current geographical location information of multiple distribution resources; the regular hexagonal lattice to which each distribution resource belongs at the Nth regular hexagonal lattice level can be determined based on the current geographical location information of multiple distribution resources, and so on.
[0052] Step D3, determining a target regular hexagonal grid level according to the regular hexagonal grids to which each distribution resource belongs at different regular hexagonal grid levels.
[0053] This embodiment can ensure that each area can get sufficient service support and avoid service hotspot and cold spot problems by evenly allocating distribution resources in different hexagonal grids.
[0054] The embodiment of the present application provides a possible implementation method. After the above step D3 determines the target regular hexagonal grid level according to the regular hexagonal grids to which each distribution resource belongs at different regular hexagonal grid levels, the following steps E1 to E3 may also be included: Step E1, obtaining the current geographical location information of each distribution resource; Step E2, determining the regular hexagonal grid to which each distribution resource belongs under the target regular hexagonal grid level according to the current geographical location information of each distribution resource; Step E3, the identification of each distribution resource, the current geographical location information, and the regular hexagonal grid to which it belongs are stored in association.
[0055] This embodiment associates and stores the identifier of the distribution resource, the current geographical location information, and the regular hexagonal grid to which the distribution resource belongs, so as to facilitate subsequent query of the distribution resource corresponding to the regular hexagonal grid and recall of the distribution resource.
[0056] A possible implementation method is provided in the embodiment of the present application. Based on the above steps E1 to E3, step S103 obtains the distribution resources corresponding to at least one polygonal grid and recalls the distribution resources of each location. Specifically, the following steps F1 may be included: Step F1, according to the identification of each distribution resource stored in association, the current geographical location information, and the regular hexagonal grid to which it belongs, obtain at least one distribution resource corresponding to a polygonal grid and recall it as the distribution resource of each location. The at least one polygonal grid here can specifically be a regular hexagonal grid.
[0057] This embodiment obtains the distribution resources within a specific regular hexagonal grid so as to quickly recall them to a specific location, which can effectively reduce the response time of the distribution resources.
[0058] A possible implementation method is provided in the embodiment of the present application, and may also include the following steps G1 and G2: Step G1, obtaining the current attribute information of each distribution resource.
[0059] In this step, the current attribute information may include the type of transport capacity, current time, geographic location accuracy, altitude, angle, speed, etc., which is not limited in this embodiment.
[0060] Step G2, associate and store the identifier of each distribution resource with the current attribute information.
[0061] This embodiment associates and stores the identification of the distribution resource with its attribute information, which can better track the usage status and historical records of the distribution resource, facilitate subsequent analysis and management work; and, in some cases, the distribution resource attributes can be quickly and accurately obtained to help the distribution center or logistics center respond quickly and adjust the distribution strategy.
[0062] The above introduces Figure 1 There are multiple implementation methods for each link of the illustrated embodiment. The distribution resource recall method of the embodiment of the present application will be further explained below through specific embodiments.
[0063] In this specific embodiment, the delivery resource is introduced using the rider as an example. As mentioned earlier, the delivery resource may also be an unmanned delivery vehicle, etc.
[0064] Redis is an open source in-memory data structure storage that supports different types of values, including geospatial information. Redis's geospatial support allows developers to store geolocation data and perform geolocation-based queries, such as calculating the distance between two geographic locations, finding all points within a given radius, etc. Redis geospatial refers to the function used to store and query geospatial information in the Redis database.
[0065] In related technologies, riders are grouped by city or by ID (Identification) hash method. Either the geographical scope is too large, causing the Redis key to be subjected to heavy traffic and thus become a hot key, or a large number of keys need to be traversed for each query, causing the overall query to slow down. These hidden dangers, on the one hand, lead to high processor usage of the overall container and Redis, and on the other hand, will cause the overall service to fail at some point in time.
[0066] The storage solution in the related technology uses the Redis geospatial data structure as the underlying storage. The riders are grouped based on Shard and rider ID hashing. For example, the hash value range is 0 to 63, which means 64 hash slices. Shard is a way of dividing the provinces in the country, and each Shard corresponds to one or more provinces.
[0067] For example, the whole country is divided into multiple Shards, for example, Shard A includes Beijing and Tianjin, Shard B includes Shanghai and Jiangsu Province, Shard M includes Guangdong Province and Guangxi Zhuang Autonomous Region, etc. If a rider is located in Shanghai, he belongs to Shard B.
[0068] Now, consider the rider ID. Suppose there is a rider whose ID is 123456. In order to store the rider's location information in the correct shard, the rider's ID is hashed to ensure that the rider information is evenly distributed on different hash shards. The choice and specific implementation of the hash function can vary depending on the application requirements, but the output result must be an integer between 0 and 63. Suppose the hash function processes the rider's ID 123456 and the calculated result is 32.
[0069] Next, the rider’s location data will be stored in the corresponding hash shard based on this hash value. Since the rider belongs to Shard B and the hash value is 32, the data may eventually be stored in the storage shard “Shard B - 32”.
[0070] Specifically, all riders are grouped into three levels according to targetType (capacity type), Shard Id (shard identifier) and rider Id hash value. Each group of riders after grouping corresponds to an index of Redis geospatial.
[0071] Consider a demand scenario: a demander will traverse all merchants across the country every 5 seconds to query the delivery riders within 3 kilometers of these merchants. For Shard Id = A, that is, all merchants in Beijing and Tianjin, a query for each merchant will correspond to all 64 keys under Shard Id = A. No matter how many merchants there are in Beijing and Tianjin, these keys will eventually become hot keys.
[0072] To sum up, according to the division method of Shard Id and rider Id hash value, all 64 keys under each Shard Id bear all query traffic within the entire Shard. The scope of Shard is relatively large (one Shard corresponds to one province or multiple provinces), so all 64 keys under the Shard become hot keys. In addition, for each query from the demand side, it is necessary to query the corresponding 64 keys of Redis, which will also encounter bottlenecks in the overall service response time.
[0073] Figure 2 A schematic diagram of the distribution resource recall service framework provided in an embodiment of the present application is shown. The distribution resource recall service framework will accept location information reports from many types of transport riders, and then store these real-time locations. The location information includes the rider's latitude and longitude and other attributes such as speed, altitude, angle, etc.
[0074] exist Figure 2 In the middle, the end, self-delivery and retail, open platform and express delivery are the demand side, that is, the real-time location source of various types of transportation capacity, such as team, crowdsourcing, third party, etc. The gateway service is the entry point for all types of transportation capacity to report real-time location. It is responsible for distributing the real-time location of the rider to the downstream and does not involve storage. The gpoint service is responsible for the storage and query of the real-time location of the rider and the storage and query of the surrounding riders.
[0075] First, the riders are grouped based on capacity type and regular hexagonal grid ID.
[0076] In this rider grouping scheme, all riders are first grouped according to their capacity type. Then, for each type of rider, the ID of the regular hexagonal grid to which the latitude and longitude of each rider's real-time location belongs is calculated. Riders in the same grid are then grouped together. Finally, each group of riders is stored in a corresponding index of Redis geospatial.
[0077] The target regular hexagonal grid selected in this specific embodiment has 11 levels and a radius of 2.4 kilometers, that is, the side length of the target regular hexagonal grid is 2.4 kilometers. With such a grid size, there will be neither too many nor too few riders in each grid.
[0078] The storage of the rider then includes the calculation of the Redis geospatial key and the fields in the geohash member.
[0079] The process of grouping riders is actually the process of calculating the Redis geospatial key to which the rider will eventually belong. First, the regular hexagonal grid ID to which the longitude and latitude of the rider belong must be calculated using the regular hexagonal spatial index algorithm, and then the Redis key is spliced out based on the capacity type and the regular hexagonal grid ID.
[0080] For example, the latitude and longitude of the rider are 112.071474 and 46.739118, the capacity type is crowdsourcing, the mark is 2, and the regular hexagon grid ID is 11.1.1488.512, then the final key is TG:11.1.1488.512-2.
[0081] After the key is obtained, the member added to the Redis geospatial index represented by the key is the real-time attribute of the rider, including rider ID, UTC (time), haccuracy, altitude, course, and speed. These attributes are required by the demander. In this embodiment, these attributes can be constructed into a string and stored.
[0082] For example, for a rider P, the Redis geospatial key calculated according to the above logic is TG:11.1.1488.512-2, then utc=1688372704, haccuracy=3.7, altitude=127.3, course=0.0, speed=30.0.
[0083] For any rider, after the above two steps, the Redis geospatial key and the member in the index are calculated, and its location can be stored for subsequent queries by surrounding riders.
[0084] Finally, the rider was recalled.
[0085] Under the division method based on capacity type and regular hexagonal spatial index, if you want to recall riders for a certain location (such as longitude and latitude) and a preset recall range (such as three kilometers), you first need to calculate which regular hexagonal grids are within three kilometers of the location. This can be achieved through the capabilities provided by the regular hexagonal spatial index. Then for these grids, you need to traverse their corresponding Redis geospatial keys to perform range filtering, and finally for the query results of these keys, you need to aggregate to get the final calculation results.
[0086] The problems solved by this embodiment are summarized as follows: First, the regular hexagonal grid-based approach can significantly reduce the number of Redis keys required for each query by the demander, thereby reducing service response time.
[0087] Compared with the grouping method based on Shard Id and rider Id hash, the rider grouping method based on regular hexagonal grid makes the rider division more granular in geographical scope and the riders are more concentrated.
[0088] The hashing of Shard ID and rider ID will first group riders in the same Shard together, which can be seen as a geographical aggregation of riders, but this range is too large, and hashing based on rider ID is no longer a geographical division but a simple hashing. Therefore, every time the demander queries the riders around a point, it can only determine which Shard the point is in, and then traverse the query in the following 64 keys.
[0089] The regular hexagonal grid method gathers riders in a relatively small and concentrated geographical range from the beginning. When the demand side queries the riders around a certain point, it can determine that this point is within a regular hexagonal grid, and then calculate which regular hexagonal grids need to be queried based on this regular hexagonal grid and range. This range is necessarily much smaller than the entire Shard, and the number of corresponding Redis keys is also relatively small.
[0090] Table 1 below compares the number of keys that need to be queried in different ranges compared to the Shard Id and rider Id hash partitioning methods described above: Table 1 scope The number of keys in a regular hexagonal grid The number of keys in the hash method of Shard ID and rider ID One kilometer 1 to 3 64 Three kilometers 3 to 6 64 Five kilometers 5 to 12 64 In this way, under the regular hexagonal grid mode, the number of Redis keys that need to be queried for each request from the demander is smaller, and the overall service response time is shorter.
[0091] Secondly, under the regular hexagonal grid method, the traffic carried by each key is also greatly reduced, avoiding the emergence of hot keys.
[0092] In the Shard mode, the 64 keys under each Shard carry the query traffic within the entire Shard, that is, any query within the Shard will be reflected on these 64 keys. This leads to the emergence of many hot keys. In the regular hexagonal grid mode, a key no longer carries the query traffic of the entire province or even multiple provinces, but at most the traffic within a five-kilometer range around it, because the general query range of the demand side is one kilometer, three kilometers, or at most five kilometers.
[0093] Therefore, this embodiment solves the problems of long query time and Redis hot keys based on the regular hexagonal grid.
[0094] In this embodiment, the technical effect achieved by the regular hexagonal grid can be reflected from the Redis processor utilization, the number of Redis hot keys, the service response time and the container processor utilization.
[0095] After switching from the Shard ID and rider ID hashing method to the regular hexagonal grid method, the number of Redis hot keys dropped from about 640 to 32, a reduction of 95%. The effect is very obvious.
[0096] The Redis processor utilization rate was reduced from 17.3% to 11.4%, a 34% reduction, which was a significant effect. The average query time of the rider recall interface was reduced by 65%, providing a better experience for the demand side. The overall utilization rate of the dual-computer room container processor was reduced by 30%, which saved 30% of the machine cost.
[0097] It should be noted that the size of the sequence number of each step in the above embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. In practical applications, all the above possible implementation methods can be combined in any way to form possible embodiments of the present application, which will not be described one by one here.
[0098] Based on the distribution resource recall methods provided in the above embodiments and based on the same inventive concept, an embodiment of the present application further provides a distribution resource recall device.
[0099] Figure 3 is a structural diagram of the distribution resource recall device provided in the embodiment of the present application. Figure 3 As shown, the distribution resource recall device may specifically include a first acquisition unit 310 , a determination unit 320 and a second acquisition unit 330 .
[0100] A first acquisition unit 310 is used to acquire geographic location information of one or more locations and a preset recall range; The determining unit 320 is used to determine, for each location in the one or more locations, at least one polygonal grid corresponding to each location within the preset recall range according to the geographical location information of each location and the preset recall range; The second acquisition unit 330 is used to acquire the distribution resources corresponding to the at least one polygonal grid and recall them as distribution resources at various locations.
[0101] A possible implementation manner is provided in an embodiment of the present application, wherein the determining unit 320 is further configured to: For each point in one or more locations, determine the polygonal grid to which each point belongs according to the geographical location information of each point; According to the polygonal grids to which each location belongs and the preset recall range, at least one polygonal grid corresponding to each location within the preset recall range is determined.
[0102] A possible implementation method is provided in an embodiment of the present application, wherein the first acquisition unit 310 is further used to: acquire the type of transportation capacity required for one or more locations; The second acquisition unit 330 is further used to: acquire the distribution resources corresponding to the at least one polygonal grid, and filter out the distribution resources that meet the transportation capacity type required by each location as the distribution resources of each location for recall.
[0103] A possible implementation method is provided in an embodiment of the present application, wherein the polygonal grid includes a regular hexagonal grid, such as Figure 4 As shown above Figure 3 The device shown may also include a regular hexagonal grid construction unit 410 for: The Platonic stereographic projection is used to project the earth's spherical surface into a regular octahedron; The projected regular octahedron is covered with a regular hexagon of a first preset side length, and each covered regular hexagonal grid is encoded, wherein the first preset side length corresponds to a first regular hexagonal grid level; The projected regular octahedron is covered with a regular hexagon of a second preset side length, and each covered regular hexagonal grid is encoded, wherein the second preset side length corresponds to a second regular hexagonal grid level; The projected regular octahedron is covered with a regular hexagon of a third preset side length, and each covered regular hexagonal grid is encoded, wherein the third preset side length corresponds to a third regular hexagonal grid level; By analogy, the projected regular octahedron is covered with a regular hexagon of the Nth preset side length, and each covered regular hexagonal grid is encoded, wherein the Nth preset side length corresponds to the Nth regular hexagonal grid level, and N is a positive integer.
[0104] A possible implementation method is provided in the embodiment of the present application, such as Figure 4 As shown above Figure 3 The device shown may also include an association relationship establishing unit 420, which is used to: Get the current geographic location information of each delivery resource; Determine, according to the current geographical location information of each distribution resource, the regular hexagonal grid to which each distribution resource belongs under the target regular hexagonal grid level; The identification of each distribution resource, the current geographical location information, and the regular hexagonal grid to which it belongs are stored in association.
[0105] A possible implementation manner is provided in an embodiment of the present application, where the second acquiring unit 330 is further configured to: According to the identification of each distribution resource stored in association, the current geographical location information, and the regular hexagonal grid to which it belongs, the distribution resource corresponding to the at least one polygonal grid is obtained and recalled as the distribution resource of each location.
[0106] A possible implementation method is provided in an embodiment of the present application, wherein the association relationship establishing unit 420 is further configured to: Get the current attribute information of each distribution resource; The identification and current attribute information of each distribution resource are associated and stored.
[0107] A possible implementation method is provided in an embodiment of the present application, wherein the current attribute information includes one or more of the capacity type, current time, geographic location accuracy, altitude, angle and speed.
[0108] Based on the same inventive concept, an embodiment of the present application also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the distribution resource recall method of any one of the above embodiments.
[0109] In an exemplary embodiment, an electronic device is provided, such as Figure 5 As shown, Figure 5 The electronic device 500 shown includes: a processor 501 and a memory 503. The processor 501 and the memory 503 are connected, such as through a bus 502. Optionally, the electronic device 500 may also include a transceiver 504. It should be noted that in actual applications, the transceiver 504 is not limited to one, and the structure of the electronic device 500 does not constitute a limitation on the embodiments of the present application.
[0110] Processor 501 may be a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 501 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0111] The bus 502 may include a path to transmit information between the above components. The bus 502 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 502 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0112] The memory 503 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0113] The memory 503 is used to store the computer program code for executing the solution of the present application, and the execution is controlled by the processor 501. The processor 501 is used to execute the computer program code stored in the memory 503 to implement the contents shown in the above method embodiment.
[0114] Among them, electronic devices include but are not limited to: mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0115] Based on the same inventive concept, an embodiment of the present application further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the distribution resource recall method of any one of the above embodiments when running.
[0116] Those skilled in the art can clearly understand that the specific working processes of the systems, devices, and modules described above can refer to the corresponding processes in the aforementioned method embodiments, and for the sake of brevity, they are not further described here.
[0117] Those skilled in the art can understand that the technical solution of the present application can be essentially or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, which includes a number of program instructions, so that an electronic device (such as a personal computer, a server, or a network device, etc.) executes all or part of the steps of the method described in each embodiment of the present application when running the program instructions. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0118] Alternatively, all or part of the steps of implementing the aforementioned method embodiments may be accomplished by hardware associated with program instructions (such as electronic devices such as personal computers, servers, or network devices), and the program instructions may be stored in a computer-readable storage medium. When the program instructions are executed by a processor of an electronic device, the electronic device executes all or part of the steps of the methods described in the embodiments of the present application.
[0119] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that within the spirit and principles of the present application, 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 deviate from the protection scope of the present application.
Claims
1. A distribution resource recall method, It is characterized in that include: Obtain geographic location information and preset recall ranges of one or more locations; For each location in the one or more locations, determining at least one polygonal grid corresponding to each location within the preset recall range according to the geographical location information of each location and the preset recall range; The distribution resources corresponding to the at least one polygonal grid are obtained and recalled as distribution resources at various locations.
2. The method according to claim 1, It is characterized in that The step of determining, for each location in the one or more locations, at least one polygonal grid corresponding to each location within the preset recall range according to the geographical location information of each location and the preset recall range includes: For each point in one or more locations, determine the polygonal grid to which each point belongs according to the geographical location information of each point; According to the polygonal grids to which each location belongs and the preset recall range, at least one polygonal grid corresponding to each location within the preset recall range is determined.
3. The method according to claim 1 or 2, It is characterized in that The method further comprises: Obtain the type of capacity required for one or more locations; The obtaining of the distribution resource corresponding to the at least one polygonal grid and recalling the distribution resource at each location includes: The distribution resources corresponding to the at least one polygonal grid are obtained, and the distribution resources that meet the transportation capacity type required by each location are screened out and recalled as the distribution resources of each location.
4. The method according to any one of claims 1 to 3, It is characterized in that The polygonal lattice comprises a regular hexagonal lattice, and the method further comprises: The Platonic stereographic projection is used to project the earth's spherical surface into a regular octahedron; The projected regular octahedron is covered with a regular hexagon of a first preset side length, and each covered regular hexagonal grid is encoded, wherein the first preset side length corresponds to a first regular hexagonal grid level; The projected regular octahedron is covered with a regular hexagon of a second preset side length, and each covered regular hexagonal grid is encoded, wherein the second preset side length corresponds to a second regular hexagonal grid level; The projected regular octahedron is covered with a regular hexagon of a third preset side length, and each covered regular hexagonal grid is encoded, wherein the third preset side length corresponds to a third regular hexagonal grid level; By analogy, the projected regular octahedron is covered with a regular hexagon of the Nth preset side length, and each covered regular hexagonal grid is encoded, wherein the Nth preset side length corresponds to the Nth regular hexagonal grid level, and N is a positive integer.
5. The method according to claim 4, It is characterized in that The method further comprises: Get the current geographic location information of multiple delivery resources in the target area; According to the current geographical location information of the plurality of distribution resources, determining the regular hexagonal grid to which each distribution resource belongs at different regular hexagonal grid levels; According to the regular hexagonal grids to which each distribution resource belongs at different regular hexagonal grid levels, the target regular hexagonal grid level is determined.
6. The method according to claim 5, It is characterized in that After determining the target regular hexagonal grid level according to the regular hexagonal grids to which the various distribution resources belong at different regular hexagonal grid levels, the method further includes: Get the current geographic location information of each delivery resource; Determine, according to the current geographical location information of each distribution resource, the regular hexagonal grid to which each distribution resource belongs under the target regular hexagonal grid level; The identification of each distribution resource, the current geographical location information, and the regular hexagonal grid to which it belongs are stored in association.
7. The method according to claim 6, It is characterized in that The obtaining of the distribution resource corresponding to the at least one polygonal grid and recalling the distribution resource at each location includes: According to the identification of each distribution resource stored in association, the current geographical location information, and the regular hexagonal grid to which it belongs, the distribution resource corresponding to the at least one polygonal grid is obtained and recalled as the distribution resource of each location.
8. A distribution resource recall device, It is characterized in that include: A first acquisition unit, used to acquire geographic location information of one or more locations and a preset recall range; A determination unit, configured to determine, for each location in the one or more locations, at least one polygonal grid corresponding to each location within the preset recall range according to the geographical location information of each location and the preset recall range; The second acquisition unit is used to acquire the distribution resources corresponding to the at least one polygonal grid and recall them as distribution resources at various locations.
9. An electronic device, It is characterized in that It comprises a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the distribution resource recall method according to any one of claims 1 to 7.
10. A storage medium, It is characterized in that The storage medium stores a computer program, wherein the computer program is configured to execute the distribution resource recall method according to any one of claims 1 to 7 when running.
Citation Information
Cited By
High-performance recall method and system for on-road goods sources in high-concurrency scene
CN121144630A
A high-performance recall method and system for on-the-way cargo sources in a high-concurrency scenario
CN121144630B
