Methods, apparatus and computer-readable storage media for multi-dimensional conditional optimal matching
By using a multi-dimensional condition optimal matching method, the problem of large data volume and low accuracy of multi-dimensional condition matching results in existing technologies is solved, achieving efficient and accurate data query and reducing the number of matching operations on the server.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ANHUI BUCKDE INFORMATION TECH CO LTD
- Filing Date
- 2022-12-12
- Publication Date
- 2026-06-30
AI Technical Summary
Existing applications often have large amounts of data and low accuracy in multi-dimensional condition matching results, requiring servers to perform multiple matching processes to meet user query needs.
The method employs a multi-dimensional conditional optimal matching approach. By acquiring the conditions for each dimension, the data is judged one by one according to the row order. The row numbers of data that meet the conditions are recorded and arranged in ascending order. The inventory quantity is gradually reduced until the demand is met. Unmet conditions are temporarily recorded, and the calculation is repeated until the task is completed.
This improved the accuracy of matching results, reduced the number of matching operations on the server, and increased query efficiency.
Smart Images

Figure CN116226206B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, and computer-readable storage medium for optimal matching of multi-dimensional conditions. Background Technology
[0002] As application software functions become increasingly diversified, business complexity also increases. Users need to query information within application software in many application scenarios. In computer software, row data has multiple data columns, and the number of multi-dimensional conditions required is less than or equal to the number of row data columns. Matching a single multi-dimensional condition with multiple existing data only requires matching one condition at a time. However, most current application software matching mechanisms use single-condition matching or simple conditions. As a result, the matching results are usually large in volume and have low accuracy, often failing to meet the user's query needs. The server needs to perform multiple matching processes to find a result that satisfies the user's query requirements. Summary of the Invention
[0003] The purpose of this invention is to address the problem that the matching results obtained from queries are usually large in volume and have low accuracy, and most of them cannot meet the user's query requirements. The server needs to perform multiple matching processes to find results that meet the user's query requirements. Therefore, this invention proposes a method, apparatus, and computer-readable storage medium for optimal matching based on multi-dimensional conditions.
[0004] To achieve the above objectives, the present invention adopts the following technical solution:
[0005] The method for optimal matching based on multi-dimensional conditions includes the following steps:
[0006] S101: Obtain the conditions for each dimension, perform a one-to-one correspondence judgment on the data according to the row order, and record the row numbers of all data that meet the conditions;
[0007] S102: Summarize the number of data row numbers recorded in step S101;
[0008] S103: Sort the total number of data row numbers recorded in step S102 in ascending order;
[0009] S104: Find the condition based on the data row number. If the condition contains this data row number, match the quantity corresponding to this condition with this data row number and deduct the quantity of this row of data to the maximum extent until the quantity of this row of data is reduced to 0. Then, this data row number stops participating in the calculation.
[0010] S105: The condition for deducting the amount of data has not been met, so the remaining amount of this required data is temporarily recorded;
[0011] S106: Proceed to the second row of data sequence number calculation, repeat steps S104 and S105 until all required quantities are deducted, and end the calculation.
[0012] As a further description of the above technical solution:
[0013] The conditions include necessary conditions, selective conditions, and master-slave conditions. Based on the conditions, the data is matched to find rows that meet the conditions, and the row sequence number N → Sr is recorded. The sequence numbers of each row are then summarized and sorted in ascending order.
[0014] As a further description of the above technical solution:
[0015] Step S104 includes the following calculation process: If the condition contains this data row number, the inventory quantity corresponding to the first row of the data row number in ascending order is reduced by the quantity corresponding to the first row of demand. If the result after the subtraction is greater than or equal to 0 (i.e., there is still inventory), then the remaining inventory quantity is subtracted from the quantity corresponding to the second row of demand. This process continues until the inventory quantity corresponding to the first row of the data row number in ascending order is reduced to 0.
[0016] Devices for multi-dimensional conditional optimal matching include:
[0017] The receiving module retrieves the conditions for each dimension and the basic status of the data.
[0018] The matching and judgment module performs a one-to-one correspondence judgment on the data according to the row order, records the row numbers of all data that meet the conditions, and the number of recorded data row numbers is counted. The total number of recorded data row numbers is sorted in ascending order. The module searches for conditions based on the data row numbers. If the condition contains the data row number, the inventory quantity corresponding to the first row of ascending order is reduced by the quantity corresponding to the first row of demand. If the result after subtraction is greater than or equal to 0 (i.e., there is still inventory), then the remaining inventory quantity is subtracted from the quantity corresponding to the second row of demand, and so on, until the inventory quantity corresponding to the first row of ascending order is reduced to 0.
[0019] If the condition for deducting the number of data is not met in the matching loop module, the remaining quantity of the required data is temporarily recorded; the second row sequence number is then processed, and the process is repeated until all the required quantities are deducted, at which point the process ends.
[0020] A computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method for optimal matching of multi-dimensional conditions.
[0021] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for optimal matching of multidimensional conditions.
[0022] A computer program product, including a computer program, which, when executed by a processor, implements the steps of the method for optimal matching of multidimensional conditions.
[0023] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0024] In this invention, the conditions and basic state of the data for each dimension are obtained. The data is sorted by row order, and the conditions are matched one-to-one. All data row numbers that meet the conditions are recorded. The number of recorded data row numbers is then sorted in ascending order. The conditions are searched based on the data row numbers. If the condition contains the data row number, the inventory quantity corresponding to the first row of ascending order is subtracted from the quantity corresponding to the first row of demand. If the result after subtraction is greater than or equal to 0 (i.e., there is still inventory), the remaining inventory quantity is subtracted from the quantity corresponding to the second row of demand. This process continues until the inventory quantity corresponding to the first row of ascending order is reduced to 0. If the condition for reducing the data quantity is not met, the remaining quantity of this demand data is temporarily recorded. The process then moves to the second row of data numbers and repeats until all the quantities required by the conditions are reduced. The process ends when the calculation is completed. By performing multi-dimensional condition matching and corresponding calculations, the accuracy of the matching results is improved. Attached Figure Description
[0025] Figure 1 A schematic diagram of the workflow structure of the method provided according to an embodiment of the present invention is shown;
[0026] Figure 2 A schematic diagram of the device structure provided according to an embodiment of the present invention is shown;
[0027] Figure 3 A schematic diagram of a computer device structure provided according to an embodiment of the present invention is shown.
[0028] Legend:
[0029] 101. Processor; 102. Memory; 103. Input device; 104. Output device. Detailed Implementation
[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0031] Explanation of formula symbols:
[0032] Data row number Sr
[0033] Number of data row sequence numbers SrQ
[0034] Summary of data row sequence number SumSrQ
[0035] Data row number count summary in ascending order SumSrQAsc
[0036] Data row numbers arranged in ascending order SrAsc
[0037] Demand N
[0038] Demand line Nr
[0039] Quantity required NrQ
[0040] Please see Figure 1-3 This invention provides a technical solution: a method for optimal matching under multi-dimensional conditions, comprising the following steps:
[0041] S101: Obtain the conditions for each dimension, perform a one-to-one correspondence judgment on the data according to the row order, and record the row numbers of all data that meet the conditions;
[0042] S102: Summarize the number of data row numbers recorded in step S101;
[0043] S103: Sort the total number of data row numbers recorded in step S102 in ascending order;
[0044] S104: Find the condition based on the data row number. If the condition contains this data row number, match the quantity corresponding to this condition with this data row number and deduct the quantity of this row of data to the maximum extent until the quantity of this row of data is reduced to 0. Then, this data row number stops participating in the calculation.
[0045] S105: The condition for deducting the amount of data has not been met, so the remaining amount of this required data is temporarily recorded;
[0046] S106: Proceed to the second row of data sequence number calculation, repeat steps S104 and S105 until all required quantities are deducted, and end the calculation.
[0047] Specifically, such as Figure 1 As shown, the conditions include necessary conditions, selective conditions, and master-detail conditions. Based on the condition requirements, the data is matched to the rows that meet the conditions, and the row sequence number N->Sr is recorded. The sequence numbers of each row are then summarized and sorted in ascending order.
[0048] Specifically, such as Figure 1 As shown, the calculation process of step S104 includes: if the condition contains this data row number, then the inventory quantity corresponding to the first row of the data row number in ascending order is reduced by the quantity corresponding to the first row of demand. If the result after the subtraction is greater than or equal to 0 (i.e., the inventory quantity is still there), then the remaining inventory quantity is subtracted from the quantity corresponding to the second row of demand. This process continues to subtract according to demand until the inventory quantity corresponding to the first row of the data row number in ascending order is reduced to 0, that is, SrAsc1—>SrAsc1SrQ-Nr1Q—>if(SrAsc1 SrQ-Nr1Q)≥0end el se SrAsc2SrQ-(SrAsc1 SrQ-Nr1Q)……loop until Nr1Q=0.
[0049] in stock:
[0050]
[0051] need:
[0052] Condition 1: Conditions B and D are satisfied; quantity 10
[0053] Condition 2: Conditions B and F are satisfied; quantity 8
[0054] Condition 3: Conditions C and F are satisfied, quantity 1
[0055] Algorithm Execution: Step 1:
[0056] The inventory line numbers that meet condition 1 are: ①, ③, ④
[0057] The inventory line numbers that meet condition 2 are: ①, ③, ④
[0058] The inventory line numbers that meet condition 3 are: ① and ④
[0059] Step 2: The sum of row number ① is 3, the sum of row number ③ is 2, and the sum of row number ④ is 3. The ascending order of the sums of the row numbers is row number ③, row number ①, row number ④.
[0060] Step 3: According to the calculation formula, first subtract the quantity of B and D, which is 10, that satisfies condition 1, using row number ③. The result is as follows:
[0061]
[0062] According to the calculation formula, after deducting the quantity in row number ③, the remaining required quantity of 4 needs to be deducted from row number ①. The result after running is as follows:
[0063]
[0064] According to the calculation formula, all the quantities in condition 1 have been satisfied at this point. We then proceed to condition 2: the calculation of the quantities of B and F (8). Since condition 1 has already reduced the quantity in row number ③ to 0, we can only deduct from row number ①. The result is as follows:
[0065]
[0066] According to the calculation formula, after deducting the quantity in row number ①, the remaining required quantity 2 needs to be deducted from row number ④. The result after running is as follows:
[0067]
[0068] According to the calculation formula, the quantities in conditions 1 and 2 have been fully satisfied. We then proceed to condition 3: the quantity of C and F. Only the quantity in row number ④ remains to be satisfied, so we can only deduct from row number ④. The result is as follows:
[0069]
[0070] The inventory for all three conditions above has been matched, and the calculation ends.
[0071] Devices for multi-dimensional conditional optimal matching include:
[0072] The receiving module retrieves the conditions for each dimension and the basic status of the data.
[0073] The matching and judgment module performs a one-to-one correspondence judgment on the data according to the row order, records the row numbers of all data that meet the conditions, and the number of recorded data row numbers is counted. The total number of recorded data row numbers is sorted in ascending order. The module searches for conditions based on the data row numbers. If the condition contains the data row number, the inventory quantity corresponding to the first row of ascending order is reduced by the quantity corresponding to the first row of demand. If the result after subtraction is greater than or equal to 0 (i.e., there is still inventory), then the remaining inventory quantity is subtracted from the quantity corresponding to the second row of demand, and so on, until the inventory quantity corresponding to the first row of ascending order is reduced to 0.
[0074] If the condition for deducting the number of data is not met in the matching loop module, the remaining quantity of the required data is temporarily recorded; the second row sequence number is then processed, and the process is repeated until all the required quantities are deducted, at which point the process ends.
[0075] A computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement a method for optimal matching of multi-dimensional conditions.
[0076] A computer-readable storage medium having a computer program thereon, wherein the steps of a method for achieving optimal matching of multidimensional conditions when the computer program is executed by a processor.
[0077] A computer program product, including a computer program, which, when executed by a processor, implements the steps of a method for optimal matching of multidimensional conditions.
[0078] This embodiment provides a schematic diagram of the server structure, such as... Figure 3 As shown, the server includes a processor 101, a memory 102, an input device 103, and an output device 104. The number of processors 101 in the server can be one or more; the figure shows one processor 101 as an example. The processor 101, memory 102, input device 103, and output device 104 in the device / terminal / server can be connected via a bus or other means. Figure 3 Taking the example of a bus link between China and Israel.
[0079] The memory 102 serves as a computer-readable storage medium, capable of storing software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the multi-dimensional condition optimal matching method in this embodiment of the invention. The processor 101 executes various functional applications and data processing of the device / terminal / server by running the software programs, instructions, and modules stored in the memory 102, thereby realizing the aforementioned multi-dimensional condition optimal matching method.
[0080] The memory 102 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on terminal usage. Furthermore, the memory 102 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 102 may further include memory remotely located relative to the processor 101, which can be linked to a device / terminal / server 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.
[0081] Input device 103 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device / terminal / server. Output device 104 may include display devices such as a display screen.
[0082] The embodiments of the present invention provide a server that can execute the multi-dimensional condition optimal matching method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0083] This invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for optimal matching of multi-dimensional conditions as provided in any embodiment of this invention.
[0084] The computer-readable storage medium of this invention can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical link having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0085] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0086] The program code contained on the storage medium can be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0087] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages—such as Java, Smallport, and C++—as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or terminal. In cases involving remote computers, the remote computer can be linked to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be linked to an external computer (e.g., via the Internet using an Internet service provider).
[0088] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
[0089] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A device for optimal matching of multi-dimensional conditions, characterized in that, include: The receiving module retrieves the conditions for each dimension and the basic status of the data. The matching and judgment module performs a one-to-one matching judgment on the data according to the row order, records the row numbers of all data that meet the conditions, and records the number of data row numbers; The recorded data row numbers are arranged in ascending order. The conditions are searched based on the data row number. If the condition contains the data row number, the inventory quantity corresponding to the first row in ascending order of the data row number is reduced by the current demand reduction quantity. If the result after the reduction is greater than or equal to 0, the remaining inventory quantity is reduced by the quantity corresponding to the next order of demand. This process continues until the inventory quantity corresponding to the first row in ascending order of the data row number is reduced to 0. The matching loop module is used to take the remaining requirements recorded by the matching judgment module as unprocessed requirements. If the unprocessed requirements do not meet the conditions for deducting the number of data, the remaining quantity of this unprocessed requirement data is temporarily recorded; the second order data row sequence number calculation is entered, and the calculation is repeated until all the required quantities are deducted, and the calculation ends.
2. A method for multi-dimensional conditional optimal matching, implemented using the apparatus for multi-dimensional conditional optimal matching as described in claim 1, characterized in that, Includes the following steps: S101: Obtain the conditions for each dimension, perform a one-to-one correspondence judgment on the data according to the row order, and record the row numbers of all data that meet the conditions; S102: Summarize the number of data row numbers recorded in step S101; S103: Sort the total number of data row numbers recorded in step S102 in ascending order; S104: Find the condition based on the data row number. If the condition contains this data row number, match the quantity corresponding to this condition with this data row number and deduct the quantity of this row of data until the quantity of this row of data is reduced to 0. Then, this data row number stops participating in the calculation. S105: Take the remaining demand recorded in step S104 as the demand to be processed. If the demand to be processed does not meet the condition of deducting the number of data, temporarily record the remaining quantity of this demand data. S106: Proceed to the second row of data sequence number calculation, repeat steps S104 and S105 until all required quantities are deducted, and end the calculation.
3. The method for multi-dimensional conditional optimal matching according to claim 1, characterized in that, The conditions include necessary conditions, selective conditions, and master-slave conditions. Based on the condition requirements, the data is matched to the rows that meet the conditions, the data row numbers that meet the conditions are recorded, and the row numbers are summarized and sorted in ascending order.
4. The method for multi-dimensional conditional optimal matching according to claim 2, characterized in that, Step S104 includes the following calculation process: If the condition contains this data row number, the inventory quantity corresponding to the first row in ascending order of the data row number is reduced by the current demand reduction quantity. If the result after the reduction is greater than or equal to 0, the remaining inventory quantity is reduced by the quantity corresponding to the next order of demand, and so on, until the inventory quantity corresponding to the first row in ascending order of the data row number is reduced to 0.
5. A computer device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 2 to 4.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 2 to 4.
7. A computer program product, including a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 2 to 4.