A data query method based on two-dimensional space
By using a pre-built convex hull and linked list method to store extreme points in a two-dimensional spatial database, the visible area of data points is quickly calculated and the simplest result set is generated, which solves the problem of users having difficulty finding products of interest accurately and improves query efficiency and user satisfaction.
Patent Information
- Application Number
- CN202210794577.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-07
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-07-07
AI Technical Summary
In a two-dimensional database, it is difficult for users to accurately find the products they are interested in because existing query methods require users to explicitly express their preferences or the output is too large to be effectively filtered.
The k-regret query method based on regret index is adopted. By pre-building convex hull and linked list to store extreme points, the visible area of data points is quickly calculated to generate the simplest result set to meet the regret index given by the user.
The query efficiency is improved. Users do not need to rebuild the convex hull and can quickly adjust it when performing different queries. The number of products output is reasonable, ensuring user satisfaction.
Smart Images

Figure CN115292362B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data query, and in particular to a data query method based on two-dimensional space. Background Art
[0002] In recent years, databases have become increasingly large. A single database often contains tens of thousands of products. However, when users access a database, they aren't interested in every product. Instead, they focus on retrieving a small number of products that meet their needs. Given the sheer volume of products in a database, it's impossible to require users to search the entire database to locate the products they're interested in. Therefore, modern databases require convenient query methods that don't require users to traverse the entire database, yet still accurately find the products they're interested in.
[0003] The difficulty of this problem lies in the complex and diverse nature of user needs, and most users cannot accurately describe their needs. For example, suppose user A accesses a used car database. Each used car is described by multiple attributes, such as price, horsepower, age, and mileage. User A wants to select an inexpensive but relatively new used car in the database. In other words, the user only cares about the car's price and age, and is less concerned with attributes like horsepower. Because the user only cares about these two attributes, this problem is described as a two-dimensional query problem. However, even if users only care about price and age, different users may prioritize these two attributes differently. Some users prefer the lowest price possible, while others are willing to spend more for a newer car. The trade-off between these two attributes often exists abstractly in the user's mind. Database systems cannot accurately describe user preferences, making it difficult to accurately find the product of interest in a two-dimensional database.
[0004] To accurately find products of interest in a two-dimensional database, scholars have proposed various database query methods. Traditional queries include top-k queries and skyline queries. For top-k queries, users must clearly indicate their preferences. For example, in the used car database mentioned above, price and age are the two attributes that users care about. Users must clearly indicate that price accounts for 40% of their preference and age accounts for 60%. Based on these specific preferences, the database calculates a score for all used cars. The scores are sorted, and the top k highest-scoring used cars are returned to the user as output. However, this approach requires users to clearly indicate their preferences, specifically the weight of each attribute in their weighting. This is a very demanding requirement, and in practice, very few users can clearly express their preferences. Some users cannot even accurately describe their preferences.
[0005] In contrast, skyline queries do not require users to express any preferences. Instead, they utilize a concept called "dominance" to retrieve products from the database and return them to the user. Specifically, if a car p outperforms another car q in all attributes, then we say that p dominates q. For example, if car p is both cheaper and newer than car q, then p dominates q. For user A, who only cares about the price and age of used cars, they clearly prefer car p to car q. In skyline queries, products that are not dominated by any other products are returned as results. However, this has the disadvantage of large output size. Although skyline queries utilize the concept of "dominance" to exclude products in the database that are dominated by other products, skyline queries have no mechanism for further filtering and will return all remaining products to the user. Therefore, in the worst-case scenario, if the "dominance" concept fails to exclude any products, the skyline query may return the entire database to the user, failing to accurately help the user find the products of interest. Summary of the Invention
[0006] In view of the above problems, the present application is proposed to provide a two-dimensional space-based data query method that overcomes the above problems or at least partially solves the above problems, including:
[0007] A data query method based on two-dimensional space is used to query a simplest set from multiple result sets that satisfy a regret index given by a user. The method comprises:
[0008] Obtaining a number of data points in a database, and generating a convex hull based on a preset rule and the data points;
[0009] determining a reduction ratio according to a regret index input by a user, and determining a maximum visible area of the convex hull corresponding to a plurality of the data points according to the reduction ratio;
[0010] determining a result set according to a maximum visible area of the plurality of data points, wherein the visible area of the result set surrounds the convex hull;
[0011] A simplest set containing the least data points is determined according to the result set.
[0012] Furthermore, the step of determining the reduction ratio based on the regret index input by the user includes:
[0013] determining a reduction ratio based on the regret index;
[0014] Reducing the data points according to the reduction ratio to generate reduced data points;
[0015] The convex hull is reduced according to the reduction ratio to generate a reduced convex hull.
[0016] Furthermore, the step of determining the maximum visible area of the convex hull corresponding to the plurality of data points according to the reduction ratio includes:
[0017] The extreme points of the reduced convex hull are stored in a clockwise direction to generate a linked list;
[0018] Determine a first extreme point and a second extreme point where an angle formed between the linked list and the reduced data point is the largest;
[0019] A maximum visible area of the reduced data point corresponding to the reduced convex hull is determined according to the first extreme point and the second extreme point.
[0020] Furthermore, before the step of storing the extreme points of the reduced convex hull in clockwise order to generate a linked list, the step further includes:
[0021] When the reduced data point is inside the reduced convex hull, the maximum visible area of the reduced data point corresponding to the reduced convex hull is zero;
[0022] or,
[0023] When the reduced data point is outside the reduced convex hull, the extreme points of the reduced convex hull are stored clockwise to generate a linked list.
[0024] Furthermore, the step of determining a result set based on the maximum visible areas of the data points, wherein the visible area of the result set surrounds the convex hull, comprises:
[0025] determining key data points among the plurality of the reduced data points, wherein a visible area of the set of the key data points surrounds the reduced convex hull;
[0026] The result set is determined according to the set of key data points.
[0027] Furthermore, the step of determining the simplest set containing the least data points based on the result set includes:
[0028] The simplest set containing the least number of key data points is determined among the result sets.
[0029] Furthermore, it also includes:
[0030] When the user updates the regret index, the convex hull and the plurality of data points are reduced according to the updated regret index.
[0031] A data query device based on two-dimensional space, the device is used to query a simplest set from multiple result sets that meet a regret index given by a user, the device comprising:
[0032] A preprocessing module, configured to obtain a plurality of data points in a database and generate a convex hull based on a preset rule and the plurality of data points;
[0033] a reduction module, configured to determine a reduction ratio according to a regret index input by a user, and determine a maximum visible area of the convex hull corresponding to a plurality of the data points according to the reduction ratio;
[0034] a calculation module, configured to determine a result set based on a maximum visible area of the plurality of data points, wherein the visible area of the result set surrounds the convex hull;
[0035] An output module is used to determine a simplest set containing the least data points based on the result set.
[0036] A computer device includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the steps of the above-mentioned two-dimensional space-based data query method are implemented.
[0037] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned two-dimensional space-based data query method.
[0038] This application has the following advantages:
[0039] In an embodiment of the present application, a plurality of data points in a database are obtained, and a convex hull is generated based on preset rules and the plurality of data points; a reduction ratio is determined based on a regret index input by a user, and the maximum visible area of the plurality of data points corresponding to the convex hull is determined based on the reduction ratio; a result set is determined based on the maximum visible area of the plurality of data points, wherein the visible area of the result set surrounds the convex hull; and a minimum set containing the least data points is determined based on the result set. By pre-constructing the convex hull, the user does not need to rebuild the convex hull each time they call a different k-regret query on the same data set, greatly improving query efficiency. By storing the extreme points clockwise in a linked list, the visible area of each data point can be quickly calculated. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for the description of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0041] Figure 1 This is a flowchart of a two-dimensional space-based data query method provided by an embodiment of the present application;
[0042] Figure 2 This is another step flow chart of a two-dimensional space-based data query method provided by one embodiment of the present application;
[0043] Figure 3 is a schematic diagram of the maximum visible area of the convex hull corresponding to a data point provided by an embodiment of the present application;
[0044] Figure 4 This is a structural block diagram of a data query device based on two-dimensional space provided by an embodiment of the present application;
[0045] Figure 5 It is a structural diagram of a computer device provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0046] To make the objectives, features, and advantages of this application more readily apparent, the present application is further described below in conjunction with the accompanying drawings and specific embodiments. It is apparent that the embodiments described are only a portion of the embodiments of this application, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments in this application without inventive effort are also within the scope of protection of this application.
[0047] It should be noted that in any embodiment of the present invention, to address the shortcomings of top-k and skyline queries, some scholars have proposed a new query method for product databases, namely, the k-regret query. This method not only retains the advantages of traditional methods but also overcomes the shortcomings of top-k and skyline queries. Unlike top-k queries, k-regret queries do not require users to provide preference information and can maintain a manageable output size. Unlike skyline queries, k-regret queries also guarantee output size and do not return the entire dataset to the user. Specifically, in the k-regret query, a quantitative metric, the "regret index," is used to describe user satisfaction and the quality of recommended products. Suppose the database recommends a subset of products to a user. If the score of the product in the subset that the user is most satisfied with is x% of the score of the product in the entire database that the user is most satisfied with, then the user's regret index for this subset is said to be (100-x)%. The lower the regret index, the more satisfied the user is with the recommended product. In a k-regret query, the user specifies a minimum acceptable regret index α. Based on this regret index α, the k-regret query finds the products in the database with the lowest regret index, ensuring that the user's regret index for these products does not exceed α. This invention aims to propose an efficient query technique for k-regret queries in two-dimensional space, thereby improving the effectiveness of k-regret queries. In particular, when executing different k-regret queries in the same database, it can fully utilize previous calculation results, avoid extensive duplication of calculations, and improve data query efficiency.
[0048] This application is based on k-regret queries and stores extreme points in a clockwise manner in a linked list for a two-dimensional space design, which greatly accelerates the calculation of the visible area. Secondly, by pre-constructing the convex hull, the pre-constructed calculation results are fully utilized to avoid a large number of repeated calculations, which greatly improves the efficiency of performing different k-regret queries on the same data set. Finally, this application can ensure that the user's regret index does not exceed α, and the number of output products will not be higher than the logarithm of the optimal solution.
[0049] Reference Figure 1-2 , showing a data query method based on two-dimensional space provided by an embodiment of the present application;
[0050] The method comprises:
[0051] S110, obtaining a number of data points in a database, and generating a convex hull based on a preset rule and the data points;
[0052] S120, determining a reduction ratio according to a regret index input by the user, and determining a maximum visible area of the convex hull corresponding to a plurality of the data points according to the reduction ratio;
[0053] S130, determining a result set according to the maximum visible areas of the data points, wherein the visible areas of the result set surround the convex hull;
[0054] S140: Determine a simplest set containing the least data points based on the result set.
[0055] In an embodiment of the present application, a plurality of data points in a database are obtained, and a convex hull is generated based on preset rules and the plurality of data points; a reduction ratio is determined based on a regret index input by a user, and the maximum visible area of the plurality of data points corresponding to the convex hull is determined based on the reduction ratio; a result set is determined based on the maximum visible area of the plurality of data points, wherein the visible area of the result set surrounds the convex hull; and a minimum set containing the least data points is determined based on the result set. By pre-constructing the convex hull, the user does not need to rebuild the convex hull each time they call a different k-regret query on the same data set, greatly improving query efficiency. By storing the extreme points clockwise in a linked list, the visible area of each data point can be quickly calculated.
[0056] Next, a data query method based on two-dimensional space in this exemplary embodiment will be further described.
[0057] As described in step S110 , a number of data points in a database are obtained, and a convex hull is generated based on a preset rule and the data points.
[0058] In one embodiment of the present invention, the specific process of "obtaining a plurality of data points in a database and generating a convex hull according to a preset rule and the plurality of data points" in step S110 may be further explained in conjunction with the following description.
[0059] It's important to note that the convex hull is defined as follows: A subset S of a plane is called convex if and only if, for any two points p and s∈S, the line segment ps lies entirely within S. (Definition of the convex hull of a plane). A good analogy for the convex hull is to stretch a rubber band, wrap it around a shape, and then allow the band to contract and tighten. The closed curve formed by the rubber band is the convex hull.
[0060] As an example, given a product database, we first preprocess the data to avoid performing large computations when the user specifies the regret index, which would affect query efficiency. Data preprocessing consists of two steps: data point extraction and convex hull construction.
[0061] In a two-dimensional query, each product in the database is described by two attributes. Therefore, each product can be considered a data point in two-dimensional Euclidean space, described by X and Y coordinates. The X axis corresponds to the value of the first attribute, and the Y axis corresponds to the value of the second attribute.
[0062] Given the data points corresponding to all products, we can construct a convex hull representation of the database. In two-dimensional Euclidean space, the convex hull can be imagined as a rubber band that just covers all points. In loose terms, given a set of points on a two-dimensional plane, the convex hull is a convex polygon formed by connecting the outermost points, which can contain all the points in the point set. The calculation of the convex hull is a classic problem in computational geometry (graphics). The calculation methods of the two-dimensional convex hull include Jarvis March, Incremental Method, Quick Hull, Divide and Conquer, Graham Scan Algorithm, Monotone Chain, Kirkpatrick-Seidel Algorithm and Chan Algorithm, etc., which will not be repeated here. This application can choose any algorithm to calculate the convex hull according to needs.
[0063] As described in step S120 , a reduction ratio is determined according to the regret index input by the user, and a maximum visible area of the convex hull corresponding to a plurality of the data points is determined according to the reduction ratio.
[0064] In an embodiment of the present invention, the specific process of “determining the reduction ratio according to the regret index input by the user” may be further explained in combination with the following description.
[0065] As described in the following steps, determining a reduction ratio according to the regret index;
[0066] As described in the following steps, the data points are reduced according to the reduction ratio to generate reduced data points;
[0067] As described in the following steps, the convex hull is reduced according to the reduction ratio to generate a reduced convex hull.
[0068] It's important to note that the regret index describes user satisfaction and the quality of recommended products. Suppose the database recommends a subset of products to a user. If the score of the product in this subset that the user is most satisfied with is x% of the score of the product in the entire database that the user is most satisfied with, then the user's regret index for this subset is (100 - x)%. The lower the regret index, the more satisfied the user is with the recommended product.
[0069] As an example, when the user gives a regret index α, the reduction ratio can be determined to be 1-α, and we need to scale the pre-constructed convex hull and the data points according to the reduction ratio.
[0070] In a specific implementation, for each data point p used to construct the convex hull, we scale it down proportionally to (1-α)p. After scaling the data points, the pre-constructed convex hull will also be scaled proportionally. The scaled convex hull can be used to execute the user's k-regret query. Although we need to scale the convex hull each time a regret index α is given, we do not need to reconstruct the convex hull from the data points. Most of the calculations of the convex hull are performed during data preprocessing. When the user makes a query, we only need to scale the pre-processed results proportionally, and this process is very fast. By pre-constructing the convex body, the user does not need to rebuild the convex body each time he calls a different k-regret query on the same dataset. Instead, the pre-constructed results can be used to perform quick data adjustments when querying, greatly improving query efficiency.
[0071] In one embodiment of the present invention, the specific process of “determining the maximum visible area of the convex hull corresponding to the plurality of data points according to the reduction ratio” may be further explained in conjunction with the following description.
[0072] As described in the following steps, when the reduced data point is inside the reduced convex hull, the maximum visible area of the reduced data point corresponding to the reduced convex hull is zero;
[0073] or,
[0074] When the reduced data point is outside the reduced convex hull, the extreme points of the reduced convex hull are stored clockwise to generate a linked list.
[0075] In one embodiment of the present invention, the specific process of "when the reduced data point is outside the reduced convex hull, storing the extreme points of the reduced convex hull in a clockwise direction to generate a linked list" can be further explained in combination with the following description.
[0076] As described in the following steps, the extreme points of the reduced convex hull are stored in a clockwise direction to generate a linked list;
[0077] As described in the following steps, determining the first and second extreme points where the angle formed between the linked list and the reduced data point is the largest;
[0078] As described in the following steps, a maximum visible area of the reduced data point corresponding to the reduced convex hull is determined according to the first extreme point and the second extreme point.
[0079] It's important to note that poles are equivalent to the vertices of the convex hull. Using a strict mathematical definition, poles are points that cannot be represented by convex combinations of other points within the convex hull. A line segment is the convex combination of its endpoints, a triangle is the convex combination of its three vertices, and a tetrahedron is the convex combination of its four vertices.
[0080] As an example, given the reduced convex hull and the reduced data points in the preprocessing, we calculate the maximum visible area of each reduced data point for the reduced convex hull. The first step in the calculation is to determine whether the reduced data point is inside or outside the reduced convex hull. If it is inside the reduced convex hull, the visible area of the data point is 0. If the data point is outside the reduced convex hull, we obtain the maximum visible area corresponding to the data point through further calculation. Intuitively speaking, the visible area is the maximum range of the convex hull that can be seen at the location of the data point. For example Figure 3 As shown in Figure 1, the key to calculating the maximum visible area lies in locating the two extreme points s and t on the reduced convex hull. If the tangent lines ds and dt formed by the reduced data point d and these two extreme points do not intersect the reduced convex hull, then the angle formed by ds and dt is the maximum visible area of the reduced convex hull corresponding to the reduced data point d. Since our reduced data points are in two-dimensional space, all the extreme points of the reduced convex hull can be arranged in a clockwise linked list. In this linked list, we can use bisection to quickly locate the valid extreme points s and t, thereby calculating the visible area corresponding to the reduced data point.
[0081] As described in step S130 , a result set is determined based on the maximum visible areas of the data points, wherein the visible areas of the result set surround the convex hull.
[0082] In one embodiment of the present invention, the specific process of "determining a result set according to the maximum visible areas of the data points, wherein the visible areas of the result set surround the convex hull" in step S130 can be further explained in conjunction with the following description.
[0083] As described in the following steps, determining key data points among the plurality of the reduced data points, wherein a visible area of the set of the key data points surrounds the reduced convex hull;
[0084] As described in the following steps, the result set is determined based on the set of key data points.
[0085] In a specific implementation, suppose there are n products in the database. After processing, each product will have a corresponding data point and visible area. The angular size of the visible area represents the importance of the data point; the larger the angular size, the more critical the data point. Next, a greedy algorithm is used to select as many key data points as possible until the corresponding visible areas of the key data points completely encompass the reduced convex hull, generating a result set. In other words, any position in the reduced convex hull can be seen by one or more selected data points.
[0086] It should be noted that the generated result set is greater than or equal to one.
[0087] As described in step S140 , a simplest set including the least data points is determined according to the result set.
[0088] In one embodiment of the present invention, the specific process of "determining the simplest set containing the least data points according to the result set" in step S140 can be further explained in combination with the following description.
[0089] As described in the following steps, the simplest set containing the least key data points among the result sets is determined.
[0090] As an example, in step S130, we select multiple visual areas that completely enclose the reduced convex hull. Each visual area corresponds to a data point extracted from a product. Therefore, we collect the products corresponding to the selected visual areas to form the final result set. Since there may be more than one result set where the visual area encloses the convex hull, we need to determine the set containing the minimum number of key data points and return it to the user. This minimal set ensures that the regret index of any user with any preference does not exceed α, and the number of products output is no more than a logarithmic multiple of the optimal solution.
[0091] In one embodiment of the present invention, it further includes:
[0092] When the user updates the regret index, the convex hull and the plurality of data points are reduced according to the updated regret index.
[0093] As an example, when the user updates the regret index α, the pre-constructed convex body is re-shrunk according to the updated regret index, and the simplest set is finally output, without rebuilding the convex body from the data points.
[0094] Example 1
[0095] Suppose user A wants to use a k-regret query to select an inexpensive, relatively new used car from a database. They simply set a regret index α, for example, 10%. This means that if the most desirable used car in the database has a score of 100, they want to find one with a score of 90 or higher. After setting α, they can begin the k-regret query. The database system will return a small number of used cars, ensuring that user A will find one with a score of 90 or higher, meaning their regret index does not exceed α. If user A is dissatisfied with the returned car, they can adjust α to, for example, 5% and run the k-regret query again. The database system will now return more and better used cars, ensuring that user A can find a car with a score of 95 or higher. It's worth noting that when performing a k-regret query again, the system doesn't need to start from scratch. Instead, it can use the convex hull obtained from the previous query to perform a secondary calculation, significantly saving the user's actual query time and improving query efficiency.
[0096] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0097] Reference Figure 4 , shows a data query device based on two-dimensional space provided by an embodiment of the present application, the device is used to query the simplest set from several result sets that meet the regret index given by the user;
[0098] Specifically include:
[0099] A preprocessing module 410 is configured to obtain a plurality of data points in a database and generate a convex hull based on a preset rule and the plurality of data points;
[0100] A reduction module 420 is configured to determine a reduction ratio based on a regret index input by a user, and determine a maximum visible area of the convex hull corresponding to a plurality of the data points based on the reduction ratio;
[0101] A calculation module 430 is configured to determine a result set based on a maximum visible area of the plurality of data points, wherein the visible area of the result set surrounds the convex hull;
[0102] The output module 440 is configured to determine a simplest set containing the least data points according to the result set.
[0103] In one embodiment of the present invention, the reduction module 420 includes:
[0104] a reduction ratio determination submodule, configured to determine the reduction ratio according to the regret index;
[0105] A data point reduction submodule, configured to reduce the data point according to the reduction ratio to generate a reduced data point;
[0106] The convex hull reduction submodule is used to reduce the convex hull according to the reduction ratio to generate a reduced convex hull.
[0107] In one embodiment of the present invention, the reduction module 420 further includes:
[0108] A linked list generation submodule, configured to store the extreme points of the reduced convex hull in a clockwise direction to generate a linked list;
[0109] a pole determination submodule, configured to determine a first pole and a second pole at which the angle formed between the linked list and the reduced data point is the largest;
[0110] The maximum visible area determination submodule is configured to determine the maximum visible area of the reduced data point corresponding to the reduced convex hull based on the first extreme point and the second extreme point.
[0111] In one embodiment of the present invention, the reduction module 420 further includes:
[0112] a data point position determination submodule, configured to, when the reduced data point is inside the reduced convex hull, determine that the maximum visible area of the reduced data point corresponding to the reduced convex hull is zero;
[0113] or,
[0114] When the reduced data point is outside the reduced convex hull, the extreme points of the reduced convex hull are stored clockwise to generate a linked list.
[0115] In one embodiment of the present invention, the calculation module 430 includes:
[0116] a key data point determination submodule, configured to determine key data points among the plurality of reduced data points, wherein a visible area of the set of key data points surrounds the reduced convex hull;
[0117] The result set determination submodule is configured to determine the result set according to the set of key data points.
[0118] In one embodiment of the present invention, the output module 440 includes:
[0119] The simplest set determination submodule is used to determine the simplest set containing the least key data points among the result sets.
[0120] In one embodiment of the present invention, it further includes:
[0121] An updating module is configured to reduce the convex hull and the plurality of data points according to the updated regret index when the user updates the regret index.
[0122] Reference Figure 5 , shows a computer device of a two-dimensional space-based data query method of the present invention, which may specifically include the following:
[0123] The computer device 12 is a general-purpose computing device. The components of the computer device 12 may include but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).
[0124] The bus 18 represents one or more of several types of bus 18 structures, including a memory bus 18 or memory controller, a peripheral bus 18, an accelerated graphics port, a processor, or a local bus 18 that utilizes any of a variety of bus 18 architectures. Examples of such architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus 18, a Micro Channel Architecture (MAC) bus 18, an Enhanced ISA bus 18, an Audio Video Electronics Standards Association (VESA) local bus 18, and a Peripheral Component Interconnect (PCI) bus 18.
[0125] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0126] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be configured to read and write to non-removable, non-volatile magnetic media (commonly referred to as a "hard drive"). Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules 42 configured to perform the functions of various embodiments of the present invention.
[0127] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in a memory. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules 42, and program data, each of which, or some combination thereof, may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0128] The computer device 12 may also communicate with one or more external devices 14 (e.g., a keyboard, a pointing device, a display 24, a camera, etc.), one or more devices that enable an operator to interact with the computer device 12, and / or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the computer device 12 may also communicate with one or more networks (e.g., a local area network (LAN)), a wide area network (WAN), and / or a public network (e.g., the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with the other modules of the computer device 12 via the bus 18. It should be understood that although Figure 5 Not shown, other hardware and / or software modules may be used in conjunction with the computer device 12, including but not limited to microcode, device drivers, redundant processing units 16, external disk drive arrays, RAID systems, tape drives, and data backup storage systems 34.
[0129] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing a two-dimensional space-based data query method provided by an embodiment of the present invention.
[0130] Specifically, when executing the above program, the processing unit 16 achieves the following: obtaining a number of data points from a database and generating a convex hull based on a preset rule and the data points; determining a reduction ratio based on a user-entered regret index, and determining the maximum visible area of the convex hull corresponding to the data points based on the reduction ratio; determining a result set based on the maximum visible area of the data points, wherein the visible area of the result set encompasses the convex hull; and determining a minimal set containing the fewest data points based on the result set. By pre-constructing the convex hull, the user does not need to rebuild the convex hull each time they call a different k-regret query on the same dataset, significantly improving query efficiency. By storing the extreme points in a clockwise linked list format, the visible area of each data point can be quickly calculated.
[0131] In an embodiment of the present invention, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a two-dimensional space-based data query method as provided in all embodiments of the present application:
[0132] That is, when executed by a processor, the program performs the following steps: obtaining a number of data points from a database and generating a convex hull based on a preset rule and the data points; determining a reduction ratio based on a user-entered regret index, and determining the maximum visible area of the convex hull corresponding to the data points based on the reduction ratio; determining a result set based on the maximum visible area of the data points, wherein the visible area of the result set encompasses the convex hull; and determining a minimal set containing the fewest data points based on the result set. By pre-constructing the convex hull, the user does not need to rebuild the convex hull each time they call a different k-regret query on the same dataset, greatly improving query efficiency. By storing the extreme points in a clockwise linked list, the visible area of each data point can be quickly calculated.
[0133] Any combination of one or more computer-readable media may be employed. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but 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 connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0134] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0135] The computer program code for performing the operations of the present invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the operator's computer, partially on the operator's computer, as a separate software package, partially on the operator's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the operator's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to connect through the Internet). The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referenced to each other.
[0136] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0137] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0138] The above is a detailed introduction to a data query method based on two-dimensional space provided by this application. Specific examples are used in this article to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method of this application and its core idea. At the same time, for general technical personnel in this field, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on this application.
Claims
1. A data query method based on two-dimensional space, characterized in that: The method is used to retrieve the simplest set from a plurality of result sets that satisfy a regret index given by a user, wherein the regret index is a percentage index describing the user's satisfaction and the quality of the recommended product, and the lower the regret index, the more satisfied the user is with the recommended product. The method comprises: Obtaining a number of data points in a database, and generating a convex hull based on a preset rule and the data points; Determining a reduction ratio based on a regret index input by a user, and determining a maximum visible area of the convex hull corresponding to a plurality of the data points based on the reduction ratio; specifically, the step of determining the reduction ratio based on the regret index input by the user comprises: determining the reduction ratio based on the regret index; reducing the data points based on the reduction ratio to generate reduced data points; and reducing the convex hull based on the reduction ratio to generate a reduced convex hull; determining a result set according to a maximum visible area of the plurality of data points, wherein the visible area of the result set surrounds the convex hull; A simplest set containing the least data points is determined according to the result set.
2. The method according to claim 1, characterized in that The step of determining the maximum visible area of the convex hull corresponding to the plurality of data points according to the reduction ratio includes: The extreme points of the reduced convex hull are stored in a clockwise direction to generate a linked list; Determine a first extreme point and a second extreme point where an angle formed between the linked list and the reduced data point is the largest; The maximum visible area of the reduced data point corresponding to the reduced convex hull is determined according to the first extreme point and the second extreme point.
3. The method according to claim 2, characterized in that Before the step of storing the extreme points of the reduced convex hull in clockwise order to generate a linked list, the method further includes: When the reduced data point is inside the reduced convex hull, the maximum visible area of the reduced data point corresponding to the reduced convex hull is zero; or, When the reduced data point is outside the reduced convex hull, the extreme points of the reduced convex hull are stored clockwise to generate a linked list.
4. The method according to claim 1, wherein The step of determining a result set based on the maximum visible areas of the plurality of data points, wherein the visible area of the result set surrounds the convex hull, comprises: determining key data points among the plurality of the reduced data points, wherein a visible area of the set of the key data points surrounds the reduced convex hull; The result set is determined according to the set of key data points.
5. The method according to claim 4, characterized in that The step of determining the simplest set containing the least data points based on the result set includes: The simplest set containing the least number of key data points is determined among the result sets.
6. The method according to claim 1, characterized in that Also includes: When the user updates the regret index, the convex hull and the plurality of data points are reduced according to the updated regret index.
7. A data query device based on two-dimensional space, characterized in that: The device is used to query a simplest set from a plurality of result sets that satisfy a regret index given by a user, wherein the regret index is a percentage index describing the user's satisfaction and the quality of the recommended product, and the lower the regret index, the more satisfied the user is with the recommended product; the device comprises: A preprocessing module, configured to obtain a plurality of data points in a database and generate a convex hull based on a preset rule and the plurality of data points; A reduction module is configured to determine a reduction ratio based on a regret index input by a user, and determine a maximum visible area of the convex hull corresponding to a plurality of the data points based on the reduction ratio. Specifically, the step of determining the reduction ratio based on the regret index input by the user comprises: determining the reduction ratio based on the regret index; reducing the data points based on the reduction ratio to generate reduced data points; and reducing the convex hull based on the reduction ratio to generate a reduced convex hull. a calculation module, configured to determine a result set based on a maximum visible area of the plurality of data points, wherein the visible area of the result set surrounds the convex hull; An output module is used to determine a simplest set containing the least data points based on the result set.
8. A computer device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the method according to any one of claims 1 to 6 when executed by the processor.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Traffic navigation method and device for variable destinations
CN110887501A
Confidential block trading system and method
CN1853193A