Batch geolocation resolution method, location recommendation system, apparatus, and medium
By obtaining a unique set of interests and building an inverted index to calculate proximity in parallel, the problem of redundant POI calculations in high-concurrency scenarios is solved, thereby improving the system's processing efficiency and throughput.
Patent Information
- Application Number
- CN202511801075.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-02
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2045-12-02
AI Technical Summary
Existing technologies exhibit redundancy when calculating the distance between the user's target and the POI in high-concurrency, high-volume request scenarios. This leads to increased CPU and memory load, decreased system throughput, and difficulty in meeting performance requirements.
By obtaining the unique set of interests of the user's target, an inverted index is built, the proximity of each unique location to the location to be recommended is calculated, and the proximity is backfilled to the user's target based on the inverted index. The calculation process is optimized by using slot arrays and offset arrays, and efficiency is improved by using parallel computing and caching mechanisms.
It significantly reduces redundant calculations, improves system throughput and scalability, and is suitable for high-concurrency scenarios such as e-commerce recommendations and O2O delivery.
Smart Images

Figure CN121233861B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of location processing technology, and in particular to a method for parsing batch geographic locations, a location recommendation system, an apparatus, and a medium. Background Technology
[0002] In various internet information service scenarios, such as internet search services, online news services, and website navigation services, specifically in e-commerce, O2O, instant delivery, or offline self-pickup businesses, the following requirement often arises: When the system obtains user location information and a batch of target items (such as products or activities), each target item is usually associated with a set of Points of Interest (POIs) (such as a list of stores that can serve the product). The system needs to find the POI closest to the user for each target item. Traditional implementations often use a two-level traversal mechanism: the outer level traverses each target item, and the inner level calculates the distance between each associated POI and the user and takes the minimum value. However, this method has significant redundancy at the data processing level: since multiple target items may be associated with the same POI, the distance between that POI and the user will be calculated multiple times in the same batch of requests. This redundancy can easily lead to a significant increase in CPU and memory load in high-concurrency, large-batch request scenarios, resulting in decreased system throughput and increased response latency, making it difficult to meet the performance requirements of actual business. Summary of the Invention
[0003] This invention aims to address at least one of the technical problems existing in the prior art. To this end, this invention proposes a batch geographic location parsing method, location recommendation system, apparatus, and medium, which can significantly reduce redundancy in the query and distance calculation process and improve the efficiency of finding the nearest POI to the user.
[0004] On one hand, embodiments of the present invention provide a method for parsing batch geographic locations, applied to a location recommendation system, wherein the system is used to process user targets, and the user targets are associated with several locations of interest; the method includes:
[0005] Obtain all the locations of interest for all user targets in the current batch and remove duplicates to obtain a unique set of interests consisting of several unique locations;
[0006] Establish an inverted index between the unique location and the user target associated with the unique location;
[0007] Obtain the proximity of each unique location to the location to be recommended;
[0008] Based on the inverted index, the proximity is backfilled to the user target associated with the corresponding unique location;
[0009] The proximity obtained from the backfilling of each user target is compared, and the optimal location for each user target is determined based on the comparison results.
[0010] The embodiments of the present invention have at least the following beneficial effects: The batch geographic location parsing method provided by the embodiments of the present invention is based on the processing idea of transforming "user target-centered" into "unique location-centered", which reduces the data processing complexity of batch geographic location parsing in the data processing process. It reduces the number of core calculations from being positively correlated with the total number of interest locations associated with the user target in the traditional solution to being positively correlated only with the number of unique locations in this batch, significantly reducing the number of repeated calculations, greatly improving the system's throughput and scalability, and is suitable for high-concurrency scenarios such as e-commerce recommendations, O2O delivery, and in-store pickup.
[0011] According to some embodiments of the present invention, the step of establishing an inverted index between the unique location and the user target associated with the unique location includes:
[0012] Assign a slot index to all user targets in the current batch;
[0013] Obtain the slot index of each unique location and the user target associated with it, and concatenate all the obtained slot indices in order into a slot array;
[0014] An offset array is generated based on the starting position corresponding to each unique location in the slot array;
[0015] The inverted index is obtained by associating the slot array, the offset array, and the slot index of each user target.
[0016] According to some embodiments of the present invention, the step of obtaining the proximity between the location to be recommended and each of the unique locations includes:
[0017] The first geographic coordinates of the location to be recommended and the second geographic coordinates of each unique location are mapped to the same unit sphere to obtain the first vector of the location to be recommended and the second vector of each unique location.
[0018] Calculate the dot product of the first vector and each of the second vectors to obtain the proximity of the proposed location to each of the unique locations.
[0019] According to some embodiments of the present invention, the step of obtaining the proximity between the location to be recommended and each of the unique locations further includes:
[0020] The unique interest set is uniformly divided into slices, and each slice is assigned to a different processing unit to compute the dot product of the first vector and each of the second vectors in parallel.
[0021] According to some embodiments of the present invention, each of the locations of interest is assigned a location priority, which includes high priority and general priority; each of the user targets maintains a priority optimal record and an arbitrary optimal record in parallel; the step of comparing the proximity obtained from the backfilling of each of the user targets and determining the optimal location for each user target based on the comparison result includes:
[0022] If the location priority of the unique location is high priority, and its proximity is better than the user target's best priority record and any best record, then the user target's best priority record and any best record are updated simultaneously.
[0023] If the location priority of the unique location is general priority, and its proximity is better than any best record of the user target, then update any best record of the user target.
[0024] When updating the optimal location associated with each user goal, if a priority optimal record exists, the location of interest corresponding to the priority optimal record is output first.
[0025] According to some embodiments of the present invention, after the step of comparing the proximity obtained from the backfilling of each user target and determining the optimal location of each user target based on the comparison result, the method further includes:
[0026] Based on any of the locations to be recommended, after obtaining the optimal location of the user's target corresponding to that location, the second vector corresponding to the optimal location is pre-stored in the cache;
[0027] When processing a new batch of user targets, if the location to be recommended has not changed, the second vector is read from the cache to calculate the proximity.
[0028] According to some embodiments of the present invention, after the step of determining the optimal location for each user target based on the comparison results, the method further includes:
[0029] After determining the optimal location for each user's target, the geographical distance between the location to be recommended and each unique location is obtained based on the dot product of the first vector and each of the second vectors.
[0030] A location recommendation system according to a second aspect embodiment of the present invention includes a server and a user, the location recommendation system being used to execute the batch geographic location parsing method described in the above-described aspect embodiment; the location recommendation system further includes:
[0031] The unique location acquisition unit is used to acquire all the interest locations of all user targets in the current batch and remove duplicates to obtain a unique interest set consisting of several unique locations;
[0032] An index building unit is used to build an inverted index between the unique location and the user target associated with the unique location;
[0033] A proximity measurement unit is used to obtain the proximity of each unique location to the location to be recommended;
[0034] An index backfilling unit is used to backfill the proximity degree to the user target associated with the corresponding unique location based on the inverted index;
[0035] An optimal update unit is used to compare the proximity obtained by backfilling each user target and determine the optimal location for each user target based on the comparison results.
[0036] A computer device according to a third aspect of the present invention includes a memory and a processor, the memory being configured to store at least one program, and the processor being configured to load the at least one program to execute the batch geographic location parsing method described in the above-described aspect embodiments.
[0037] A computer-readable storage medium according to a fourth aspect of the present invention includes a memory and a processor, the memory being configured to store at least one program, and the processor being configured to load the at least one program to perform the batch geographic location parsing method described in the above-described aspect embodiments.
[0038] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0039] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0040] Figure 1 This is a flowchart of a batch geographic location parsing method according to an embodiment of the present invention;
[0041] Figure 2 This is a flowchart illustrating the implementation of a specific embodiment of the present invention;
[0042] Figure 3 This is a schematic diagram of the segmentation in an embodiment of the present invention;
[0043] Figure 4 This is a schematic diagram of a dual-channel system according to an embodiment of the present invention;
[0044] Figure 5 This is a structural diagram of a computer device provided in another embodiment of the present invention. Detailed Implementation
[0045] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0046] In the description of this invention, "several" means one or more, "multiple" means two or more, "greater than," "less than," "exceeding," etc. are understood to exclude the stated number, and "above," "below," "within," etc. are understood to include the stated number. If "first," "second," etc. are used in the description, they are only for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features or the order of the indicated technical features.
[0047] The concepts involved in this invention are explained below:
[0048] Slot index: A unique integer index of the target item within this batch;
[0049] POI: Point of interest;
[0050] User goal: Represents a behavior that can be satisfied by a point of interest (POI) under certain conditions. A user goal is associated with multiple POIs, and each user goal has an object (such as a product or activity) that is closest to the POI.
[0051] Unique POI set: The set obtained after deduplicating all POIs participating in this batch, i.e., the unique interest set. A unique POI is a unique location.
[0052] CSR Inverted Index: Compressed Sparse Row, a data structure specifically designed for efficient storage and representation of sparse matrices;
[0053] Priority / Arbitrary Best Record: Two sets of best proximity (dot product) and corresponding POI identifiers are maintained for each slot;
[0054] SIMD: Single Instruction Multiple Data, is a parallel computing technique that allows a single processor instruction to process multiple data elements simultaneously.
[0055] Please refer to Figure 1 , Figure 2 , Figure 1 This is a flowchart illustrating a batch geographic location parsing method according to an embodiment of the present invention. This embodiment discloses a batch geographic location parsing method applied to a location recommendation system. The system processes user targets, which are associated with several locations of interest. The method specifically includes:
[0056] Step S100: Obtain all interest locations of all users in the current batch and remove duplicates to obtain a unique interest set consisting of several unique locations;
[0057] It should be noted that the user targets in the location recommendation system of this invention can be several user targets generated independently by the user terminal, or multiple user targets uploaded by the server terminal can be processed by the server. This invention does not impose any restrictions on this. A user target represents a behavior that can be satisfied by a Point of Interest (POI) under certain conditions. A user target is associated with multiple POIs. For example, in one embodiment, the user target in the location recommendation system can be generated by the mobile phone or other electronic devices of a user in a certain geographical location who needs to go to a certain restaurant. The user target is the type of food that the user wants to eat, and the POIs are restaurants that can provide these types of food. Multiple restaurants can provide the same type of food, corresponding to a user target being associated with multiple POIs. In the prior art, a double-layer traversal is often used, that is, the outer layer traverses the target item (food requirement), and the inner layer traverses the POI list of the target item (restaurants that can provide the food). When the number of target items and POIs in the POI list is too large, this double-layer traversal processing method will consume a lot of system resources. For example, if a user's goal involves three types of food (A, B, and C), and restaurants a, b, and c can provide these three types of food respectively, then in the existing technology's process of traversing A, B, and C, restaurants a, b, and c will each be searched three times. Therefore, to reduce the resource consumption of the above recommendation process, the batch geographic location parsing method of this embodiment first obtains all points of interest (POIs) related to all user goals in the current batch in step S100, and then performs deduplication on the POIs. The purpose of global deduplication is to construct a unique set of interests without repetition; that is, the unique locations in the unique set of interests are essentially POIs obtained based on the user goals, but the same POI obtained during the traversal of user goals will only appear once in this set. The above operation is the basic preprocessing step for improving computational efficiency in this embodiment of the invention: by eliminating the repeated occurrence of the same POI among different user goals, the core calculation number of subsequent proximity is reduced from being related to the total number of associations to being related only to the number of unique POIs.
[0058] Step S200: Build an inverted index between unique locations and user targets associated with unique locations;
[0059] It should be noted that an inverted index is an efficient data organization structure. Its core idea is to reverse the traditional "subject-attribute" mapping relationship and establish an "attribute-subject" mapping relationship. In this embodiment of the invention, each user target is associated with one or more locations of interest, and among these locations of interest, there is an optimal location of interest. For example, restaurants a, b, and c (locations of interest) all provide food A (user target), and restaurant b has the closest real-time location on the user's end (the location to be recommended). Therefore, in this scenario, restaurant b is the optimal location of interest for the user to obtain food A at their current location. Furthermore, an inverted index specifically refers to a mapping structure from a unique location to the user targets associated with that unique location. The inverted index also has a data storage structure capable of storing proximity levels: through a pre-established index, the system can quickly determine all user targets associated with a unique location, thereby synchronously backfilling and updating the proximity level of a single location to the optimal location of multiple associated user targets. In some specific embodiments of the invention, the inverted index of user targets and proximity levels can be implemented using data structures such as linked lists, dynamic arrays, skip lists, hash buckets, and compressed sparse rows.
[0060] Step S300: Obtain the proximity of each unique location to the location to be recommended;
[0061] It should be noted that step S300, based on the unique interest set filtered in step S100, obtains the proximity degree between each unique location and the location to be recommended. The location to be recommended in this embodiment of the invention can be the real-time location of the user's terminal in the system, a specified location of the user's terminal, etc., as long as the user's target generated based on the above location can obtain effective locations of interest. Furthermore, the proximity degree is a quantitative indicator reflecting the proximity relationship between each unique location and the location to be recommended, providing a unified comparison basis for subsequent selection decisions. Step S200 avoids the repeated measurement of the same location of interest in traditional schemes by batch acquiring each unique location in the deduplicated unique interest set at once.
[0062] Step S400: Based on the inverted index, backfill the proximity score to the user target associated with the corresponding unique location;
[0063] It should be noted that in step S400, the proximity of the unique location obtained in step S300 to the location to be recommended is backfilled into the data storage structure corresponding to the inverted index of the unique location and the user target established in step S200, so that each unique location can be directly associated with the user target. This mechanism ensures that the proximity of each unique location only needs to be calculated once, and the calculation result can be synchronously updated with the optimal record of all associated user targets through the inverted index. This batch processing method optimizes the computational complexity of the traditional scheme, which is proportional to the total number of associations, to be proportional only to the number of unique locations, eliminating the repeated calculation of the same geographical location and significantly improving the efficiency of the system in processing batch data.
[0064] Step S500: Compare the proximity of each user's target backfill to determine the optimal location for each user's target based on the comparison results.
[0065] It should be noted that the optimal location in this embodiment of the invention refers to the optimal location of interest for each user target under the corresponding constraints. For example, for user target a, both restaurants A and B can be provided, but restaurant A is the closest / has the best price / has the highest positive review rate. Therefore, in the corresponding evaluation system, restaurant A is the optimal location for user target a. Based on this, step S500 dynamically updates the optimal location by comparing the proximity data backfilled to each user target. It is understandable that during the backfilling process, a user target may be repeatedly backfilled with the proximity of different unique locations. In this case, by comparing the currently stored proximity in the data storage structure of the inverted index with the newly acquired proximity, it can be determined which of the two unique locations corresponding to the proximity is closer to the location to be recommended, and then the closer one is left in the data storage structure of the inverted index. When the entire backfilling process is completed, the unique location corresponding to the proximity in the data storage structure of the inverted index is the optimal location. This step completes the maintenance of the records corresponding to all user targets in a single processing flow, and ensures that the optimal location of interest finally determined for each user target has global optimality through a unified comparison rule.
[0066] It should be noted that in steps S100 to S500, the processing concept of shifting from "user-target-centered" to "unique-location-centered" reduces the data processing complexity of batch geographic location parsing. This reduces the core computation count from being positively correlated with the total number of interest locations associated with the user target in the traditional scheme to being positively correlated only with the number of unique locations in this batch. Based on the traditional scheme, the computation count ≈ the number of user targets. The number of Points of Interest (POIs) corresponding to a user's target. It's understandable that when a large number of target items share the same POI, the number of repeated calculations will increase exponentially. However, the core calculation count of this invention is approximately equal to the total number of unique POIs. Subsequently, only linear scans and constant-level comparison updates are performed on the data storage structure. When the sharing degree is high (as is common in real-world business), the core calculation volume is almost folded down to the order of the number of unique POIs, significantly improving throughput. For example, in the above embodiments, the traditional approach requires calculating the proximity between the user and restaurants a, b, and c nine times to obtain the optimal location of interest for each user target, based on the proximity calculations for food types A, B, and C and restaurants a, b, and c. However, the method provided by this invention only requires calculating the proximity between the user and restaurants a, b, and c three times.
[0067] Additionally, refer to Figure 1 , Figure 2 In step S200 of the above-described embodiments, the following steps are also included, but are not limited to:
[0068] Step S210: Assign a slot index to all user targets in the current batch;
[0069] Step S220: Obtain the slot index of each unique location and its associated user target, and concatenate all the obtained slot indices into a slot array in order;
[0070] Step S230: Generate an offset array based on the starting position of each unique location in the slot array;
[0071] Step S240: Associate the slot array, offset array, and slot index of each user target to obtain the inverted index.
[0072] It should be noted that steps S210 to S240 are the process of applying the Compressed Sparse Row (CSR) data structure to the inverted index in this embodiment of the invention. After obtaining the unique set of interests, a slot index needs to be allocated for each user target, specifically by sequentially numbering each user target (slot ∈ [0, N)). The slot is essentially a memory address mapping of the user target in the batch array. After the user target obtains a unique slot index, a sparse mapping from the unique location to the slot index list is constructed based on the CSR structure. The CSR structure specifically includes: a slot array [offsets] (its length = the total number of unique POIs + 1), which stores the start and end positions of each unique POI in the slots array; and an offset array [slots] (its length = the number of all "POI→slot" associations), which stores the slot indexes sequentially. Since the association method of "unique location - multiple slots" is inherently highly sparse, the inverted index based on the CSR structure is superior to general structures such as linked lists / hash tables in terms of memory usage, sequential traversal and cache locality, which is beneficial for the rapid backfilling of single batches of user targets.
[0073] Below is a specific example of establishing a CSR structure:
[0074] • Deduplication: Set the POI IDs of all target items to obtain POI_unique = {p_0 … p_(U-1)}.
[0075] • Slot allocation: Sequentially number the target items in slot ∈ [0, N).
[0076] • Inverted index construction: For each p_j, collect its associated slot sequence and concatenate them into slots; at the same time, accumulate the prefix sum to construct offsets, so that the slot interval of the j-th POI is [offsets[j], offsets[j+1]).
[0077] • Storage: offsets length U+1, slots length equal to the total number of associations Σ|POI_i|. This structure is sequentially scannable, facilitating single-batch backfilling.
[0078] Below is an example of a CSR structure. Assume there are 3 unique POIs and 5 target item slots, with the following relationship: POI0 → associated slot [0, 2];
[0079] POI1 → Associated slot [0, 1, 3];
[0080] POI2 → Associated slot [1, 4];
[0081] The corresponding CSR structure is:
[0082] offsets = [0, 2, 5, 7];
[0083] slots = [0, 2, 0, 1, 3, 1, 4].
[0084] The specific meaning of each data stored in the offsets array (length = number of unique POIs + 1) is as follows: offsets[0] = 0: the associated slot of POI0 starts from slots[0]; offsets[1] = 2: the associated slot of POI1 starts from slots[2]; offsets[2] = 5: the associated slot of POI2 starts from slots[5]; offsets[3] = 7: end marker (total number of associated slots). The specific meaning of each data stored in the slots array (length = total number of associated slots) is as follows: index 0-1: [0,2] → slot associated with POI0; index 2-4: [0,1,3] → slot associated with POI1; index 5-6: [1,4] → slot associated with POI2.
[0085] Furthermore, step S300 in the above-described embodiments also includes, but is not limited to, the following steps:
[0086] Step S310: Map the first geographic coordinates of the location to be recommended and the second geographic coordinates of each unique location to the same unit sphere to obtain the first vector of the location to be recommended and the second vector of each unique location.
[0087] Step S320: Calculate the dot product of the first vector and each second vector to obtain the proximity of the location to be recommended to each unique location.
[0088] It should be noted that steps S310 to S320 are a specific embodiment of obtaining proximity in this invention. This involves transforming the location to be recommended and each unique location into the same three-dimensional coordinate system, thereby vectorizing the geographic coordinates of these two locations. Finally, the dot product of the two vectors quantifies the proximity relationship between the location to be recommended and each unique location. In actual data processing, the dot product eliminates the need for inverse triangulation and multiple square roots, making it more suitable for large-scale batch comparisons. Furthermore, it is monotonically equivalent to spherical distance, ensuring consistent sorting results. In small-angle scenarios, directly using Haversine inverse triangulation may be affected by rounding. Dot product comparison avoids inverse triangulation, resulting in more stable values and facilitating batch SIMD.
[0089] In a specific embodiment of the present invention, the specific operation of converting the location to be recommended and the unique location into a spherical three-dimensional vector with the Earth's radius as the unit is as follows: mapping latitude and longitude (lat, lon) to:
[0090] x = cos(lat) cos(lon) , y = cos(lat) sin(lon) , z = sin(lat) .
[0091] Additionally, refer to Figure 3 In step S300 of the above-described embodiments, the following steps are also included, but are not limited to:
[0092] Step S301: The unique interest set is uniformly divided into slices, and each slice is assigned to a different processing unit to compute the dot product of the first vector and each second vector in parallel.
[0093] It should be noted that, since the above embodiments process geographic locations based on unique interest sets, the number of unique locations in the unique interest set is fixed. Therefore, compared to traditional solutions, this embodiment of the invention can use a fragmentation processing method to evenly distribute the unique locations in the unique interest set across multiple threads / processes; see details below. Figure 3 After vectorizing the user location and unique location, the unique location in the unique interest set can be assigned to shards Worker#1, Worker#2, ..., Worker#k (the specific number of shards is set according to actual needs). The dot product of the first vector and the second vector is calculated and backfilled into the associated user target. Furthermore, a local "slot-optimal" snapshot can be maintained for each shard, and lock-free merging is performed at the end (to facilitate obtaining a larger dot product). This mechanism enables each shard to process in parallel without waiting for or blocking each other by maintaining its own independent slot-optimal record snapshot (i.e., the calculation results temporarily stored within the shard) for each computation shard. After all shards have been calculated, the system summarizes the snapshots and selects the optimal value at the end through a lock-free merging operation (an atomic comparison and replacement process without locking, global SlotRecord[]), thereby effectively avoiding the lock contention problem (i.e., the performance degradation caused by mutual exclusion waiting between threads) caused by multiple threads concurrently updating the same data, and significantly improving parallel efficiency.
[0094] Additionally, refer to Figure 4 In step S400 of the above-described embodiment, each location of interest is assigned a location priority, which includes high priority and general priority; each user target maintains a priority optimal record and an arbitrary optimal record in parallel; this step also includes, but is not limited to, the following steps:
[0095] Step S410: If the location priority of the unique location is high priority and its proximity is better than the user target's priority best record and any best record, then update the user target's priority best record and any best record simultaneously.
[0096] Step S420: If the location priority of the unique location is general priority and its proximity is better than any best record of the user target, then update any best record of the user target.
[0097] In step S430, when updating the optimal location of interest associated with each user's target, if a priority optimal record exists, the location of interest corresponding to the priority optimal record will be output first.
[0098] It should be noted that in steps S410 to S420, in some practical application scenarios, the priority determination of the optimal location of interest for certain user targets is subject to special rules, such as "priority given to open stores, priority given to flagship stores," etc., making the modification of the optimal location of interest no longer solely based on distance. To address this situation, this embodiment of the invention provides, for example... Figure 4 The mechanism shown employs a dual-channel recording maintenance system, maintaining two independent evaluation systems in parallel within each user target slot: bestPriorityDot and anyAnyDot. Specifically, this mechanism sets up two priority evaluation channels: bestPriorityDot and anyAnyDot. The bestPriorityDot is updated only by high-priority POIs; the anyAnyDot can be updated by any POI. The update logic is as follows: if a point of interest has a high priority (poi.priority = high) and the dot product of its second vector and the first vector of the target location is better than the proximity of the corresponding points of interest recorded in bestPriorityDot and bestAnyDot, then the best point of interest in both channels is updated simultaneously. If a point of interest has a normal priority (poi.priority = normal) and the dot product of its second vector and the first vector of the target location is better than the proximity of the corresponding points of interest in bestAnyDot, then only the bestAnyDot channel is updated. By establishing a dual-channel update rule, strategies such as "open for business / flagship store priority" can be implemented within the same batch of traversals without adding extra outer traversals, and performance is not affected. It is understood that the priority of the best record is greater than any other best record. Therefore, in step S430 of this embodiment, when the proximity score is backfilled to the user target associated with the unique location, if the user target has both a best record and any other best record, then the best location of interest for the user target is updated with the proximity score corresponding to the best record.
[0099] In addition, after step S400 in the above-described embodiments, the following steps are included, but are not limited to:
[0100] Step S510: Based on any location to be recommended, after obtaining the optimal location of the user's target corresponding to that location, the second vector corresponding to the optimal location is pre-stored in the cache;
[0101] Step S520: When processing a new batch of user targets, if the position to be recommended has not changed, the second vector is read from the cache to calculate the proximity.
[0102] It should be noted that steps S510-S520 introduce a vector caching mechanism to cache the invariant second vector V_p for recurring user locations (such as within the same session); and to reduce scheduling overhead by aggregating multiple batches of requests using micro-batch aggregation. Therefore, when consecutive batches of user requests have the same location to be recommended, the system will directly reuse the cached location of interest vector, skipping the conversion calculation from geographic coordinates to vectors and the corresponding normalization process. This mechanism reduces the vector calculation overhead for the corresponding location of interest to zero, significantly reducing the average time complexity of the system processing subsequent batches. Especially in high-concurrency scenarios, it effectively reduces the load on the computing unit, contributing to an improvement in the overall system throughput.
[0103] In addition, after step S400 in the above-described embodiments, the following steps are included, but are not limited to:
[0104] Step S600: After determining the optimal location for each user's target, the geographical distance between the location to be recommended and each unique location is obtained based on the dot product of the first vector and each second vector.
[0105] It should be noted that, in this embodiment of the invention, the actual geographical distance between the location to be recommended and each unique location can be obtained using the inverse cosine function arccos(dot)*R, where dot is the dot product of the first vector V_user of the location to be recommended and the unique location V_pj, and R is the Earth's radius. By using the above method, the actual distance between the location to be recommended and the optimal location for each user's target can be obtained, facilitating the location recommendation system to provide navigation, positioning, and other services.
[0106] Secondly, embodiments of the present invention provide a location recommendation system, including a server and a user, wherein the location recommendation system is used to execute the batch geographic location parsing method of the embodiments described above; the system further includes:
[0107] The unique location acquisition unit is used to acquire all interest locations of all user targets in the current batch and remove duplicates to obtain a unique interest set consisting of several unique locations;
[0108] The index building unit is used to build an inverted index between unique locations and user targets associated with unique locations;
[0109] The proximity measurement unit is used to obtain the proximity of each unique location to the location to be recommended;
[0110] The index backfilling unit is used to backfill the proximity to the corresponding unique location associated with the user target based on the inverted index;
[0111] The optimal update unit is used to compare the proximity of each user's target backfill and determine the optimal location for each user's target based on the comparison results.
[0112] It should be noted that the location recommendation system in this embodiment of the invention, through the collaboration of five core units, solidifies the methodological optimizations into system architectural advantages. This architecture enables the system to achieve a performance improvement in processing throughput that is proportional to the data redundancy, providing support for real-time geographic location resolution in high-concurrency scenarios.
[0113] The following is a specific embodiment of the batch parsing process of this invention:
[0114] Reference Figure 2 , Figure 2 A complete implementation process is provided:
[0115] • Input: user(lat,lon), which is a set of user targets and the POIs associated with each user target (including the priority identifier corresponding to each user target).
[0116] • Preprocessing steps:
[0117] Remove duplicate user(lat, lon) values and construct POI_unique (unique interest set); assign slot indexes to each user's target; construct CSR inverted index (the mapping range of POI -> slot); vectorize: user coordinates -> V_user (first vector), POI coordinates -> V_pj (second vector corresponding to each unique location). • Core traversal:
[0118] e. Calculate the dot product dot_j = V_pj • V_user;
[0119] f. Scan the offset array slots[k] within the range of k ∈ [offsets[j], offsets[j+1]) of the CSR slot array offsets to obtain the corresponding slot (slot that stores the optimal proximity of the location);
[0120] g. Update the optimal dual-channel record for this slot according to the dual-channel record maintenance mechanism (priority channel takes precedence; otherwise, any channel).
[0121] h. Repeat steps e, f, and g until there are no uncomputed POIs in POI_unique.
[0122] • Distance calculation: Based on actual needs, obtain the actual distance between the user's target and the optimal location, and calculate the actual distance based on distance = arccos(dot) * R_earth.
[0123] • Summary Output: Output the nearest POI for all slots according to the "priority → any" rule.
[0124] The following are specific examples of the above steps in practical applications:
[0125] • Product A (slot=0): [POI-1 (preferred), POI-2 (normal)]
[0126] • Product B (slot=1): [POI-2 (regular), POI-3 (regular)]
[0127] •Unique POI = {POI-1, POI-2, POI-3};
[0128] •CSR: offsets=[0,1,3,4], slots=[0,0,1,1];
[0129] • V_user and V_pj are mapped using a unit sphere 3D vector, traversing unique POIs, and updating the dual-channel records of slot=0,1 according to the dual-channel record maintenance mechanism update rules;
[0130] • Output: If the priority channel is valid, set slot=0; if only any channel is valid, set its slot=1.
[0131] like Figure 5 As shown, Figure 5 This is a structural diagram of a computer device provided in one embodiment of the present invention. The present invention also provides a computer device, comprising:
[0132] The processor 801 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0133] The memory 802 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 802 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 802 and is called and executed by the processor 801 to execute the batch geographic location parsing method of the embodiments of this application.
[0134] The 803 input / output interface is used to implement information input and output.
[0135] The communication interface 804 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0136] Bus 805 transmits information between various components of the device (e.g., processor 801, memory 802, input / output interface 803, and communication interface 804);
[0137] The processor 801, memory 802, input / output interface 803, and communication interface 804 are connected to each other within the device via bus 805.
[0138] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof. The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate, and may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0139] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically include computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0140] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A method for parsing batch geographic locations, characterized in that, An application to a location recommendation system, wherein the system processes user targets, which are associated with several locations of interest; the method includes: Obtain all the locations of interest for all user targets in the current batch and remove duplicates to obtain a unique set of interests consisting of several unique locations; Establish an inverted index between the unique location and the user target associated with the unique location; Obtain the proximity of each unique location to the location to be recommended; Based on the inverted index, the proximity is backfilled to the user target associated with the corresponding unique location; The proximity obtained from the backfilling of each user target is compared, and the optimal location for each user target is determined based on the comparison results.
2. The method for parsing batch geographic locations according to claim 1, characterized in that, The step of establishing an inverted index between the unique location and the user target associated with the unique location includes: Assign a slot index to all user targets in the current batch; Obtain the slot index of each unique location and the user target associated with it, and concatenate all the obtained slot indices in order into a slot array; An offset array is generated based on the starting position corresponding to each unique location in the slot array; The inverted index is obtained by associating the slot array, the offset array, and the slot index of each user target.
3. The method for parsing batch geographic locations according to claim 1, characterized in that, The step of obtaining the proximity between the location to be recommended and each of the unique locations includes: The first geographic coordinates of the location to be recommended and the second geographic coordinates of each unique location are mapped to the same unit sphere to obtain the first vector of the location to be recommended and the second vector of each unique location. Calculate the dot product of the first vector and each of the second vectors to obtain the proximity of the proposed location to each of the unique locations.
4. The method for parsing batch geographic locations according to claim 3, characterized in that, The step of obtaining the proximity between the location to be recommended and each of the unique locations further includes: The unique interest set is uniformly divided into slices, and each slice is assigned to a different processing unit to compute the dot product of the first vector and each of the second vectors in parallel.
5. The method for parsing batch geographic locations according to claim 1, characterized in that, Each of the stated locations of interest is assigned a location priority, which includes high priority and general priority; each user target maintains a priority optimal record and an arbitrary optimal record in parallel; the step of comparing the proximity obtained from the backfilling of each user target and determining the optimal location for each user target based on the comparison result includes: If the location priority of the unique location is high priority, and its proximity is better than the user target's best priority record and any best record, then the user target's best priority record and any best record are updated simultaneously. If the location priority of the unique location is general priority, and its proximity is better than any best record of the user target, then update any best record of the user target. When updating the optimal location associated with each user goal, if a priority optimal record exists, the location of interest corresponding to the priority optimal record is output first.
6. The method for parsing batch geographic locations according to claim 3, characterized in that, After comparing the proximity results obtained from the backfilling of each user target, and determining the optimal location for each user target based on the comparison results, the method further includes: Based on any of the locations to be recommended, after obtaining the optimal location of the user's target corresponding to that location, the second vector corresponding to the optimal location is pre-stored in the cache; When processing a new batch of user targets, if the location to be recommended has not changed, the second vector is read from the cache to calculate the proximity.
7. The method for parsing batch geographic locations according to claim 3, characterized in that, After the step of determining the optimal location for each user target based on the comparison results, the method further includes: After determining the optimal location for each user's target, the geographical distance between the location to be recommended and each unique location is obtained based on the dot product of the first vector and each of the second vectors.
8. A location recommendation system, characterized in that, The location recommendation system includes a server-side and a user-side component, and is used to execute the batch geographic location parsing method according to any one of claims 1 to 7; The location recommendation system also includes: The unique location acquisition unit is used to acquire all the interest locations of all user targets in the current batch and remove duplicates to obtain a unique interest set consisting of several unique locations; An index building unit is used to build an inverted index between the unique location and the user target associated with the unique location; A proximity measurement unit is used to obtain the proximity of each unique location to the location to be recommended; An index backfilling unit is used to backfill the proximity degree to the user target associated with the corresponding unique location based on the inverted index; An optimal update unit is used to compare the proximity obtained by backfilling each user target and determine the optimal location for each user target based on the comparison results.
9. A computer device, characterized in that, The system includes a memory and a processor, the memory being used to store at least one program, and the processor being used to load the at least one program to execute the batch geographic location parsing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the batch geographic location parsing method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Interest point recommendation method and electronic equipment
CN115146151A
Location-Based Search Refinements
US20170067748A1