Search tree mixed query acceleration optimization method and device for Snesim modeling
By constructing a Reverse Assisted Retrieval Structure (RARS) and combining forward and reverse query strategies, the Snesim modeling method is dynamically optimized, solving the problem of low query efficiency in the early stage of simulation. This achieves a dual improvement in computational efficiency and geological feature reproducibility, making it suitable for large-scale geological modeling.
Patent Information
- Application Number
- CN202610045753.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-14
- Publication Date
- 2026-05-05
AI Technical Summary
The existing Snesim modeling method suffers from low query efficiency when the initial simulation conditions are sparse, which limits the overall modeling efficiency and fails to meet the needs of large-scale geological modeling.
A hybrid query optimization method based on search tree modeling for Snesim is adopted. By constructing a reverse assisted retrieval structure (RARS), a reverse query strategy is used in the early stage of the simulation to perform non-recursive retrieval using the most certain condition points. In the middle and later stages of the simulation, the forward query strategy is switched to dynamically adapt to the evolution of condition data from sparse to dense, thereby shortening the search query time.
It significantly improves the computational efficiency and speed of overall modeling, while maintaining the statistical feature preservation ability and geological structure feature reproducibility of the Snesim algorithm. It is applicable to two-dimensional and three-dimensional training images and has good engineering application value.
Smart Images

Figure CN121980046A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of geostatistical modeling technology, and in particular to a method and apparatus for accelerating and optimizing hybrid search tree queries for Snesim modeling. Background Technology
[0002] Multiple-point geostatistics (MPS) effectively characterizes the spatial heterogeneity of reservoirs and quantitatively describes the distribution and superposition relationships of various lithofacies in three-dimensional space. With the continuous development of oil and gas exploration, the number of simulation grid cells required for geological modeling has reached tens of millions to reveal the internal structure of reservoirs more precisely. This also means that the simulation process faces enormous challenges in terms of computation time and memory usage. Related experts and scholars are dedicated to optimizing and improving MPS algorithms to enhance modeling efficiency.
[0003] Currently, based on the number of grid nodes simulated in each iteration, MPS methods are generally categorized into pixel-level algorithms and block-level algorithms. Pixel-level algorithms, represented by Snesim, significantly improve the efficiency of early pixel-level algorithms by constructing a conditional probability search tree. However, when processing training images with long-range spatial correlation features, if the template size is too large, the size of the search tree increases rapidly, leading to a substantial increase in memory usage and computational cost, thus limiting efficiency. Block-level algorithms, represented by SIMPAT and Direct Sampling (DS), are generally more efficient than pixel-level algorithms because they simulate a batch of nodes at a time. However, the core problem with SIMPAT lies in the severe imbalance and inconsistency in simulation efficiency throughout the process. While the algorithm's speed is acceptable in the early stages of simulation (when conditional data is sparse), as the simulation progresses, the conditional data around the simulated nodes becomes highly dense. Traditional query mechanisms at this point must perform deep and complex layer-by-layer matching and filtering within a vast search tree to satisfy all the constraints of these dense conditions. This leads to a non-linear increase in computational load and time consumption per node, causing a sharp drop in speed in the later stages of the simulation, severely limiting the efficiency of large-scale, high-precision geological modeling. Although the DS algorithm has the advantage of dynamically adjusting the neighborhood size, its single-step simulation requires scanning a large portion of the training images, and its computational efficiency still limits its large-scale application. Furthermore, in practical applications, factors such as the selection of simulation paths and the retrieval mechanism of training image patterns also significantly impact the computational efficiency of existing algorithms. With the development of refined geological modeling technology and the increasing demand for large-scale, high-resolution modeling, Snesim's computational efficiency is gradually showing certain limitations, becoming a significant factor restricting its further widespread application.
[0004] Therefore, a new comprehensive conditional probability query method is needed to improve computational efficiency while maintaining the excellent statistical feature preservation ability and soft and hard data collaborative prediction function of the Snesim algorithm, so as to meet the needs of large-scale, high-resolution simulation for fine geological modeling. Summary of the Invention
[0005] In view of this, the present invention provides a method and apparatus for accelerating and optimizing search tree hybrid queries for Snesim modeling, in order to solve the technical problem that the existing Snesim modeling method has low query efficiency and slows down the overall modeling efficiency when the initial condition data is sparse, and cannot meet the current needs of large-scale geological modeling.
[0006] To achieve the above-mentioned technical objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a method for accelerating and optimizing hybrid queries using search trees for Snesim modeling, comprising: Obtain training images and data templates, scan the training images using the data templates, and construct a search tree containing all data events and their repetition counts in the training images based on the Snesim method; Based on the search tree, a reverse auxiliary retrieval structure is constructed, and a mapping relationship is established between the attribute values, level depth and node index of each node in the search tree. Obtain the geometric parameters and data file of the simulation mesh, initialize the simulation mesh based on the geometric parameters, allocate the data to the corresponding nodes of the simulation mesh, and define random paths for accessing the nodes of the simulation mesh; The current simulation progress is determined based on the number of nodes that have been traversed and assigned values on the random path to determine whether the current progress is less than the preset progress threshold. If the simulation progress is less than the progress threshold, a reverse query strategy is adopted, and the reverse auxiliary retrieval structure is used to retrieve the search tree nodes that meet the conditions, and the local conditional probability distribution of the nodes to be simulated is statistically analyzed. If the simulation progress is greater than or equal to the progress threshold, a forward query strategy is adopted to match data events layer by layer starting from the root node of the search tree and to statistically analyze the local conditional probability distribution of the node to be simulated. Random sampling is performed based on the local conditional probability distribution. The sampling results are assigned to the nodes to be simulated and used as conditional data for subsequent simulations until all grid nodes have been simulated.
[0007] Furthermore, a search tree containing all data events and their repetition counts in the training images is constructed based on the Snesim method, including: Initialize a search tree containing only the root node; The data template is slid across the training image to extract all occurrences of data events; Each extracted data event is inserted into the search tree one by one. If the path corresponding to the data event already exists, the duplicate count of the corresponding node is increased. If the path does not exist, a new node is created and the repetition count is initialized until all data events within the training image range based on the data template are inserted into the search tree.
[0008] Furthermore, a reverse auxiliary retrieval structure is constructed based on the search tree, including: Create a dictionary set corresponding to each level of the search tree; Traverse each node of the search tree to obtain the attribute category value corresponding to the node in the training image and the level depth of the node in the search tree; The attribute category value is used as the key, and the set of all search tree nodes with the same attribute category value and located at the same level depth is used as the value and stored in the dictionary of the corresponding level.
[0009] Furthermore, constructing a search tree based on the Snesim method that contains all data events and their repetition counts in the training images also includes: Assign a node path code to each node in the search tree. The node path code is used to identify the path from the root node to the node, so as to represent the data event sequence corresponding to the node. The reverse auxiliary retrieval structure is also used to store the node path code for each node.
[0010] Furthermore, the reverse query strategy includes: Select the condition point that is furthest from the node to be simulated from the data events; Based on the level and value of the condition point in the search tree, for each candidate node in the set, the node path code is read through the reverse auxiliary retrieval structure, and it is determined whether the attribute value sequence represented by the node path code is consistent with the attribute values of other known condition data points in the current data event except for the farthest condition point. Candidate nodes with consistent attribute values are selected, and the number of repetitions of the attribute value at the center position of the node is counted to calculate the local conditional probability distribution.
[0011] Furthermore, the reverse query strategy also includes: If there are no candidate tree nodes that satisfy all condition point constraints, delete the current farthest condition point and re-execute the reverse query until a matching node is obtained or all condition points are deleted.
[0012] Furthermore, the forward query strategy includes: Initialize the current search tree node as the root node; Determine whether there is a known conditional data point at the position corresponding to the next level of the search tree for the current data event; If a known conditional data point exists, only the child node with the same attribute value as that known conditional data point will be retained as the current search tree node at the next level. If no known conditional data points exist, then all child nodes of the current node are retained as candidate paths for the next level. The above judgment process is executed until a leaf node of the search tree is reached or no further matching is possible. The number of duplicate central attribute values of all retained path terminal nodes is counted.
[0013] Furthermore, the forward query strategy also includes: When the number of matching paths obtained from a forward query is less than a preset threshold, a template simplification operation is performed on the data event to increase the number of matching paths.
[0014] Secondly, the present invention also provides a search tree hybrid query acceleration and optimization device for Snesim modeling, comprising: The search tree construction module is used to obtain training images and data templates, scan the training images using the data templates, and construct a search tree containing all data events and their repetition counts in the training images based on the Snesim method. The reverse auxiliary retrieval structure construction module is used to construct a reverse auxiliary retrieval structure based on the search tree and establish a mapping relationship between the attribute values, level depth and node index of each node in the search tree. The configuration module is used to obtain the geometric parameters and data files of the simulation mesh, initialize the simulation mesh based on the geometric parameters, allocate data to the corresponding nodes of the simulation mesh, and define random paths for accessing the simulation mesh nodes. The strategy control module is used to determine whether the current simulation progress is less than a preset progress threshold based on the number of nodes that have been traversed and assigned values on the random path. If the simulation progress is less than the progress threshold, a reverse query strategy is adopted to retrieve search tree nodes that meet the conditions using the reverse auxiliary retrieval structure and to statistically analyze the local conditional probability distribution of the nodes to be simulated. If the simulation progress is greater than or equal to the progress threshold, a forward query strategy is adopted to match data events layer by layer starting from the root node of the search tree and to statistically analyze the local conditional probability distribution of the nodes to be simulated. The probability statistics and assignment module is used to perform random sampling based on the local conditional probability distribution, assign the sampling results to the nodes to be simulated and use them as conditional data for subsequent simulations until all grid nodes have been simulated.
[0015] Thirdly, the present invention also provides a computer-readable storage medium for storing a computer-readable program or instruction, which, when executed by a processor, can implement the steps in the hybrid query acceleration optimization method for search tree modeling oriented towards Snesim in any of the above implementations.
[0016] Compared with existing technologies, the proposed method and apparatus for accelerating and optimizing hybrid queries based on search trees for Snesim modeling has the following advantages: (1) This method addresses the core problem of low efficiency in the early stages of simulation using the traditional Snesim algorithm through dynamic strategy switching. When conditional data points are sparse in the grid, the method employs a reverse query strategy, utilizing a pre-built Reverse Auxiliary Retrieval Structure (RARS) to perform a non-recursive search starting from the conditional point with the most certain information. By searching downwards layer by layer, it avoids a large number of invalid traversals of the search tree, greatly shortening the search query time. Experiments demonstrate that this strategy switching can significantly improve the overall computational efficiency and speed of modeling.
[0017] (2) This method dynamically adapts to the evolution of conditional data from sparse to dense, ensuring that the algorithm always runs in a highly efficient mode throughout the entire simulation cycle, thus maximizing the acceleration potential of the Snesim algorithm. While improving computational efficiency, it can completely preserve the high-order spatial patterns and geological features learned by the Snesim algorithm in the training images, ensuring the quality of the final simulation results and the reproducibility of geological structural features. It can be applied to two-dimensional and three-dimensional training images, and has good engineering application value and wide applicability.
[0018] In summary, this invention effectively solves the bottleneck of low initial computational efficiency in large-scale geological modeling using the traditional Snesim algorithm through a dynamic optimization mechanism, shortens simulation time, and achieves a dual improvement in computational efficiency and geological feature reproducibility, providing a practical optimization method for the efficient engineering application of multi-point geostatistics. Attached Figure Description
[0019] Figure 1 A flowchart illustrating the accelerated optimization method for hybrid query of search tree for Snesim modeling provided by this invention; Figure 2a This is a schematic diagram of the search tree structure provided by the present invention; Figure 2b This invention provides a search tree and a corresponding reverse search auxiliary structure diagram; Figure 3a The two-dimensional training image provided by this invention; Figure 3bThis invention provides a diagram illustrating the relationship between the simulation progress and time consumption of two-dimensional training images. Figure 4a The three-dimensional training images provided by this invention; Figure 4b The diagram showing the relationship between the simulation progress and time consumption of three-dimensional training images provided by this invention; Figure 5 The flowchart of the Snesim algorithm based on reverse search tree provided by this invention; Figure 6 This invention provides a schematic diagram of the principle for retrieving duplicate counts based on a reverse query structure. Figure 7a A comparison chart showing the cumulative time and simulation progress of the simulation calculation of two-dimensional images by the method provided in this invention and the original Snesim method; Figure 7b A comparison chart of the cumulative time taken to simulate 3D images and the simulation progress between the method provided for the invention and the original Snesim method; Figure 8 A schematic diagram of the structure of the hybrid query acceleration and optimization device for Snesim modeling provided by the present invention. Detailed Implementation
[0020] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0021] Before introducing the embodiments of the present invention, the concept of the present invention will first be explained.
[0022] Geostatistics uses statistical probability theory to perform spatial analysis on geological sampling data to achieve spatial prediction. Multipoint geostatistics (MPS) uses data events to define the positional relationships between multiple points in space.
[0023] Assuming the attributes of the research objective have There are several states (representing various phase types), namely S k If k=1,…,K, then a “data event” with size n centered at u is defined. It consists of the following two parts: ① n vectors A defined geometric shape is called a data template, denoted as , and ② the n data values at the endpoints of the n vectors.
[0024] Therefore, the probability of the value of the point to be estimated under multi-point constraints can be expressed as a data event. The probability of occurrence, i.e., the probability of n data points in a data event. Each in The probability of a given state can be expressed as the expected value of the product of n data indicators, i.e.: Under the assumption of stationarity, data events Number of repetitions in training images With training image size The ratio is equivalent to the data event. The probability of occurrence, i.e.: Snesim employs a search tree dynamic data structure to store all possible data events and their repetitions in the training image, eliminating the inefficiency of repeatedly scanning the training image. The search tree consists of many leaf nodes, which store the repetition count of all possible data events and the value of the center point u in the training image. The root node represents the repetition count without any constraints (i.e., global proportion). Starting from the root node, the conditional data for the data events corresponding to the leaf nodes increases sequentially; these leaf nodes are formed by adding further conditional points to their parent nodes.
[0025] In the existing Snesim simulation process, as the simulation progresses, the number of available conditional data points in the data events gradually increases and exhibits a spatial clustering trend. The specific changes in query efficiency are as follows: (1) In the early stages of simulation, the search template typically contains multiple adjacent positions, but only a few of these positions have been assigned values, and most grid nodes have not yet been simulated. This results in limited available conditional data around the prediction point, leading to sparse conditional data in the data events formed at this stage. Furthermore, these few known data points are often far from the prediction point due to the random simulation path. Therefore, when retrieving conditional probabilities from the search tree, the algorithm must examine a large number of potential combinations across multiple levels of the tree, resulting in high traversal costs and low query efficiency.
[0026] (2) As the simulation progresses, more nodes in the grid are assigned values, which gradually increases the number of known neighbors around each predicted point. Therefore, the data events become denser, and the conditional data contained therein are spatially closer to the predicted point. In this case, many paths within the search tree can be quickly eliminated based on early mismatches, and the number of tree nodes required for a successful query is significantly reduced, thereby greatly improving query efficiency.
[0027] To address the significant efficiency differences between the early and later stages of simulation, this invention proposes a hybrid probabilistic retrieval method that combines forward and reverse query mechanisms. By employing the most suitable query method at different simulation stages, the overall modeling efficiency is improved.
[0028] Please see Figure 1 This embodiment provides a method for accelerating hybrid queries using search trees for Snesim modeling, including: Step S101: Obtain training images and data templates, scan the training images using the data templates, and construct a search tree containing all data events and their repetition counts in the training images; Step S102: Construct a reverse auxiliary retrieval structure based on the search tree, and establish a mapping relationship between the attribute values, level depth and node index of each node in the search tree; Step S103: Obtain the geometric parameters and data file of the simulation mesh, initialize the simulation mesh based on the geometric parameters, allocate the data to the corresponding nodes of the simulation mesh, and define random paths for accessing the simulation mesh nodes; Step S104: Determine whether the current simulation progress is less than the preset progress threshold based on the number of nodes that have been traversed and assigned values on the random path. Step S105: If the simulation progress is less than the progress threshold, a reverse query strategy is adopted: the reverse auxiliary retrieval structure is used to retrieve the search tree nodes that meet the conditions, and the local conditional probability distribution of the nodes to be simulated is statistically analyzed. Step S106: If the simulation progress is greater than or equal to the progress threshold, a forward query strategy is adopted: starting from the root node of the search tree, data events are matched layer by layer, and the local conditional probability distribution of the node to be simulated is statistically analyzed. Step S107: Perform random sampling based on the local conditional probability distribution, assign the sampling results to the nodes to be simulated and use them as conditional data for subsequent simulations until all grid nodes have been simulated.
[0029] The core of the method provided in this embodiment lies in the design of a dynamic query strategy that combines forward and reverse queries. First, while constructing the Snesim search tree, an additional Reverse Assisted Retrieval Structure (RARS) is built to establish the mapping relationship between data event attribute values and search tree nodes. Second, the simulation progress is used as a strategy switching indicator. In the early stages of the simulation, a reverse query strategy is adopted, using RARS to directly locate candidate nodes for each conditional data point, narrowing the search space at each step and reducing redundancy in search tree traversal. In the later stages of the simulation, the method switches back to the efficient traditional forward query strategy. This method can dynamically adapt to the evolution of conditional data from sparse to dense, shortening the search query time and improving the computational efficiency and speed of Snesim modeling while ensuring the reproducibility of geological structural features.
[0030] In a preferred embodiment, step S101 involves constructing a search tree based on the Snesim method, containing all data events and their repetition counts in the training image, including: Initialize a search tree containing only the root node; The data template is slid across the training image to extract all occurrences of data events; Each extracted data event is inserted into the search tree one by one. If the path corresponding to the data event already exists, the duplicate count of the corresponding node is increased. If the path does not exist, a new node is created and the repetition count is initialized until all data events within the training image range based on the data template are inserted into the search tree.
[0031] To accelerate the efficiency of reverse lookups, as a preferred embodiment, this method introduces an auxiliary data structure of Reverse Assisted Retrieval Structure (RARS). In step S102, the reverse assisted retrieval structure is constructed based on the search tree, including: Create a dictionary set corresponding to each level of the search tree; Traverse each node of the search tree to obtain the attribute category value corresponding to the node in the training image and the level depth of the node in the search tree; The attribute category value is used as the key, and the set of all search tree nodes with the same attribute category value and located at the same level depth is used as the value and stored in the dictionary of the corresponding level.
[0032] like Figure 2a As shown, Figure 2a As a typical search tree structure, RARS is built upon a search tree and uses node path codes assigned to each tree node (e.g., r00, r1100) to organize nodes for efficient access. Structurally, as... Figure 2b As shown, RARS can be viewed as a set of dictionaries, with each level of the search tree being its corresponding dictionary. The level index directly corresponds to the depth of the search tree (e.g., the first level is L1). Within each level, nodes are categorized based on the last digit of their node path code at that depth. Specifically, for each dictionary entry: ① the key is a specific attribute value within that level (i.e., the last digit of the node path code); ② the value is a set containing all tree nodes with the same key value within that level. This organization allows the algorithm to quickly retrieve all candidate nodes that satisfy a given conditional data value at any specific level without scanning the entire search tree.
[0033] During the reverse lookup process, candidate nodes for each conditional data point are directly located by accessing the corresponding dictionary layer in RARS. This structure significantly reduces the number of tree nodes that need to be checked by narrowing the search space at each step, especially in the early stages of the simulation when conditional data is sparse and far from the prediction nodes. Furthermore, since node filtering can be performed independently at each layer, the reverse lookup strategy is suitable for parallel execution on multiple threads or processing cores, resulting in a significant acceleration of the computation process. However, it is important to note that to achieve optimal performance, it is crucial to appropriately determine the switching point between reverse and forward looksup during the simulation, as the degree of efficiency improvement depends on the density of conditional data at different stages.
[0034] In some embodiments, constructing a search tree based on the Snesim method that contains all data events and their repetition counts in the training image further includes: Assign a node path code to each node in the search tree. The node path code is used to identify the path from the root node to the node, so as to represent the data event sequence corresponding to the node. The reverse auxiliary retrieval structure is also used to store the node path code for each node.
[0035] As a specific embodiment, in step S103, the simulation progress is used as a key indicator for determining the query strategy. The method for determining whether the current simulation progress is less than a preset progress threshold is as follows: calculate the ratio of the number of simulated nodes to the total number of nodes in the simulation grid, i.e.: ; When the simulation progress is less than the progress threshold (in the early stages of simulation), there are very few known conditional data points in the simulation grid, and the effective information points in data events are sparse. If a traditional forward query is used, the conditional points are very far from the central simulated point. In this case, a forward query would require a very deep search tree, resulting in a large number of branches needing to be searched, leading to extremely low retrieval efficiency. Therefore, a reverse query is used at this time, starting the search from the point with the most certain information (the farthest point), which can quickly locate potential matching areas and save a lot of time.
[0036] As the simulation progresses, more and more nodes in the grid are assigned values. When the simulation progress exceeds the progress threshold, the known condition data points in the data events become denser. At this point, using forward lookup can utilize more and closer condition point information in the data events to quickly dig deeper into the search tree, eliminating mismatched branches, thus improving query efficiency.
[0037] It should be noted that, based on test results, the recommended threshold for practical applications is usually set to 35%.
[0038] In a preferred embodiment, in step S104, the reverse query strategy includes: Select the condition point that is furthest from the node to be simulated from the data events; Based on the level and value of the condition point in the search tree, for each candidate node in the set, the node path code is read through the reverse auxiliary retrieval structure, and it is determined whether the attribute value sequence represented by the node path code is consistent with the attribute values of other known condition data points in the current data event except for the farthest condition point. Candidate nodes with consistent attribute values are selected, and the number of repetitions of the attribute value at the center position of the node is counted to calculate the local conditional probability distribution.
[0039] As a preferred embodiment, the reverse query strategy further includes: If there are no candidate tree nodes that satisfy all condition point constraints, delete the current farthest condition point and re-execute the reverse query until a matching node is obtained or all condition points are deleted.
[0040] As a specific example, the reverse query strategy proceeds as follows: The matching process begins with the conditional data point furthest from the center point in a data event: Assuming a data event has several conditional points, first locate the furthest conditional point and obtain its value; then, search the search tree for all nodes at the depth level corresponding to that conditional value (i.e., the location of that conditional point); next, determine whether these nodes also satisfy the value requirements of the other conditional points in the current data event at other locations. If a data event that satisfies the conditions exists, its repetition count is directly counted for subsequent simulations; if no data node that satisfies all conditions is found, the furthest conditional point is removed, and the next furthest conditional point is used as the starting point for matching. This process is repeated until enough matching data events are obtained for probability statistics.
[0041] In a preferred embodiment, in step S105, the forward query strategy includes: Initialize the current search tree node as the root node; Determine whether there is a known conditional data point at the position corresponding to the next level of the search tree for the current data event; If a known conditional data point exists, only the child node with the same attribute value as that known conditional data point will be retained as the current search tree node at the next level. If no known conditional data points exist, then all child nodes of the current node are retained as candidate paths for the next level. The above judgment process is executed until a leaf node of the search tree is reached or no further matching is possible. The number of duplicate central attribute values of all retained path terminal nodes is counted.
[0042] In a preferred embodiment, the forward query strategy further includes: When the number of matching paths obtained from a forward query is less than a preset threshold, a template simplification operation is performed on the data event to increase the number of matching paths.
[0043] The effectiveness of the present invention will be demonstrated below through specific comparative experimental results.
[0044] In some embodiments, Figure 3a For two-dimensional training images, Figure 3b To simulate the progress and time consumption of two-dimensional training images, by establishing the relationship curve between the simulation progress and cumulative time consumption of Snesim, it can be found that under two-dimensional training images, the cumulative time consumption of the first 30% of the simulation progress accounts for 90% of the total time consumption. Figure 4a For 3D training images, Figure 4b This diagram illustrates the relationship between the progress and time consumed in simulating 3D training images. It shows that, with 3D training images, the first 30% of the simulation progress accounts for 94% of the total time. Therefore, the focus of this method is to compress the time consumed in the first 30% of the simulation progress, thereby improving the overall simulation efficiency.
[0045] As a specific embodiment, the method of this embodiment mainly consists of two stages to construct the search tree and its corresponding RARS; The first stage uses training images and data templates to construct a search tree, which records all possible data events and their frequency. The second stage generates RARS based on the completed search tree. The specific process is as follows: The first step is to scan the training images using data templates, extract all spatial patterns, and collect these patterns into a pattern database for subsequent tree structure construction.
[0046] The second step is to initialize the root node of the search tree. At this stage, data events only include the central node of the data template and do not consider any neighborhood information.
[0047] The third step is to traverse each pattern in the pattern database and decompose it into a series of corresponding data events, which represent different combinations of conditional data.
[0048] Fourth, for each data event, check if it already exists in the search tree. If it exists, increment the duplicate count of the corresponding tree node; if it does not exist, create a new node with a duplicate count of 1 and insert it into the search tree.
[0049] Fifth, after all data events have been inserted, the algorithm traverses the search tree to establish parent-child relationships between nodes. If a node is the root node, processing is skipped; for other nodes, its parent node is identified, and the current node is linked to the parent node as a child node.
[0050] Step 6: Construct a Reverse Assisted Retrieval Structure (RARS) based on the search tree. RARS is organized as an array, where each index corresponds to a level in the search tree. At each level, a dictionary is created: the keys of the dictionary represent the attribute category of the training image (e.g., phase type), and the values are the set of all tree nodes with the corresponding attribute at that level. This structure enables fast retrieval of candidate nodes during the reverse query process, thus significantly improving query efficiency even with sparse conditional data. Figure 5 As shown, Figure 5 The process of the Snesim algorithm based on reverse search tree is demonstrated.
[0051] Figure 6 This paper demonstrates the principle and specific process of counting the number of repeated values at position R of a statistical event based on a reverse lookup auxiliary structure. Taking a simulated grid node R as an example, a template is used to extract its corresponding data event. Assume the code of this data event is r???1, where the symbol "?" indicates that there is no conditional data at that position, and only the 4th position (farthest point) has a conditional point with a value of 1. Since the effective length of the current data event is 4, that is, the conditional point is the 4th position in the data template, its target level in the search tree is L5 (the root node is level 1). Based on the conditional point's value of 1, all tree nodes with a value of 1 can be located in the L5 level of RARS as a candidate set. In this example, the nodes that meet the conditions include node ⑮ (node path code r0011) and node ⑯ (node path code r0101), which represent complete data events with different path codes but a value of 1 at the 4th position. Since this data event contains only one conditional point, and the other positions are empty, both of these candidate nodes satisfy the conditional requirements of the current data event. Subsequently, the corresponding nodes are searched in the search tree using index numbers ⑮ and ⑯, and the repetition count of their center point values is read. Finally, the conditional probability distribution for location 𝑢 is calculated, and random sampling is performed. If the data event contains conditional data at locations other than the farthest node, the matching process needs to further determine whether the node path code of the candidate node at the corresponding location matches the data event. A candidate node can only participate in probability statistics if all known condition points match. If no candidate node fully satisfies the conditions, the current farthest condition point must be removed, the data event reconstructed, and the above process repeated. Compared to traditional forward query strategies, this method utilizes a pre-built reverse search structure to quickly locate potential matching nodes in the search tree and determine whether the conditions are met in parallel. This avoids the process of traversing layer by layer from the root node, significantly reducing computation and improving the efficiency of data event querying in the early stages of the simulation.
[0052] like Figure 7a and Figure 7bAs shown, Figure 7a and Figure 7b Figure 1 shows a comparison of the cumulative time taken to simulate two-dimensional and three-dimensional images using the method of this embodiment and the original Snesim method, respectively, representing the relationship between simulation progress. The simulation is performed using two-dimensional images (…). Figure 3a ) and 3D images ( Figure 4a Example tests compare the computational efficiency of three scenarios: traditional forward query simulation (red solid line), 100% reverse query simulation (blue solid line), and simulation where the first 30% of the simulation progress uses reverse queries (green solid line). The results show that dividing the simulation progress into two parts—using reverse queries for the first 30% and forward queries for the remaining 70%—significantly reduces computation time. The speedup for 2D images is 4.09, and for 3D images, it increases to 9.46. These experimental results demonstrate the effectiveness of the proposed method.
[0053] like Figure 8 As shown, this embodiment of the invention also provides a search tree hybrid query acceleration and optimization device 800 for Snesim modeling, comprising: The search tree construction module 801 is used to obtain training images and data templates, scan the training images using the data templates, and construct a search tree containing all data events and their repetition counts in the training images based on the Snesim method. The reverse auxiliary retrieval structure construction module 802 is used to construct a reverse auxiliary retrieval structure based on the search tree and establish a mapping relationship between the attribute values, level depth and node index of each node in the search tree. The configuration module 803 is used to obtain the geometric parameters and data file of the simulation mesh, initialize the simulation mesh based on the geometric parameters, allocate data to the corresponding nodes of the simulation mesh, and define random paths for accessing the simulation mesh nodes. The strategy control module 804 is used to determine whether the current simulation progress is less than a preset progress threshold based on the number of nodes that have been traversed and assigned values on the random path; if the simulation progress is less than the progress threshold, a reverse query strategy is adopted to retrieve search tree nodes that meet the conditions using the reverse auxiliary retrieval structure, and to statistically analyze the local conditional probability distribution of the nodes to be simulated; if the simulation progress is greater than or equal to the progress threshold, a forward query strategy is adopted to match data events layer by layer starting from the root node of the search tree, and to statistically analyze the local conditional probability distribution of the nodes to be simulated. The probability statistics and assignment module 805 is used to perform random sampling based on the local conditional probability distribution, assign the sampling results to the nodes to be simulated and use them as conditional data for subsequent simulations until all grid nodes have been simulated.
[0054] This embodiment also provides a computer-readable storage medium storing a search tree hybrid query acceleration optimization program for Snesim modeling, which, when executed by a processor, can implement the steps in the above embodiments.
[0055] This paper proposes a hybrid query acceleration optimization method for Snesim modeling, addressing the issues of high memory consumption and slow computation speed of traditional Snesim under large-scale grids and complex training images. This scheme combines CPU parallel optimization with reverse query technology, designing a combined forward / reverse query strategy: reverse queries are used in the early stages of simulation to reduce retrieval time, while forward queries are switched in the later stages to maintain efficiency. Experimental results show that the optimal acceleration effect is achieved when reverse queries are used in the first 35% of the simulation, and this has been validated on multiple 2D and 3D training images. Comparison with different Snesim implementations and other MPS algorithms verifies the effectiveness of the method. The speedup ratio increases logarithmically with the size of the search tree, and tends to plateau after reaching a certain threshold with the increase of the number of parallel threads. This method improves the modeling efficiency of Snesim and provides a feasible solution for large-scale geological modeling.
[0056] 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 changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for accelerating and optimizing hybrid queries using search trees for Snesim modeling, characterized in that, include: Obtain training images and data templates, scan the training images using the data templates, and construct a search tree containing all data events and their repetition counts in the training images based on the Snesim method; Based on the search tree, a reverse auxiliary retrieval structure is constructed, and a mapping relationship is established between the attribute values, level depth and node index of each node in the search tree. Obtain the geometric parameters and data file of the simulation mesh, initialize the simulation mesh based on the geometric parameters, allocate the data to the corresponding nodes of the simulation mesh, and define random paths for accessing the nodes of the simulation mesh; The current simulation progress is determined based on the number of nodes that have been traversed and assigned values on the random path to determine whether the current progress is less than the preset progress threshold. If the simulation progress is less than the progress threshold, a reverse query strategy is adopted, and the reverse auxiliary retrieval structure is used to retrieve the search tree nodes that meet the conditions, and the local conditional probability distribution of the nodes to be simulated is statistically analyzed. If the simulation progress is greater than or equal to the progress threshold, a forward query strategy is adopted to match data events layer by layer starting from the root node of the search tree and to statistically analyze the local conditional probability distribution of the node to be simulated. Random sampling is performed based on the local conditional probability distribution. The sampling results are assigned to the nodes to be simulated and used as conditional data for subsequent simulations until all grid nodes have been simulated.
2. The method for accelerating and optimizing hybrid queries of search trees for Snesim modeling according to claim 1, characterized in that, A search tree containing all data events and their repetition counts in the training images is constructed based on the Snesim method, including: Initialize a search tree containing only the root node; The data template is slid across the training image to extract all occurrences of data events; Each extracted data event is inserted into the search tree one by one. If the path corresponding to the data event already exists, the duplicate count of the corresponding node is increased. If the path does not exist, a new node is created and the repetition count is initialized until all data events within the training image range based on the data template are inserted into the search tree.
3. The method for accelerating and optimizing hybrid queries for search trees oriented to Snesim modeling according to claim 1, characterized in that, Constructing a reverse auxiliary retrieval structure based on the search tree includes: Create a dictionary set corresponding to each level of the search tree; Traverse each node of the search tree to obtain the attribute category value corresponding to the node in the training image and the level depth of the node in the search tree; The attribute category value is used as the key, and the set of all search tree nodes with the same attribute category value and located at the same level depth is used as the value and stored in the dictionary of the corresponding level.
4. The method for accelerating and optimizing hybrid queries for search tree modeling based on Snesim, as described in claim 2, is characterized in that... Constructing a search tree based on the Snesim method that contains all data events and their repetition counts in the training images, and further including: Assign a node path code to each node in the search tree. The node path code is used to identify the path from the root node to the node, so as to represent the data event sequence corresponding to the node. The reverse auxiliary retrieval structure is also used to store the node path code for each node.
5. The method for accelerating and optimizing hybrid queries of search trees for Snesim modeling according to claim 1, characterized in that, The reverse query strategy includes: Select the condition point that is furthest from the node to be simulated from the data events; Based on the level and value of the condition point in the search tree, for each candidate node in the set, the node path code is read through the reverse auxiliary retrieval structure, and it is determined whether the attribute value sequence represented by the node path code is consistent with the attribute values of other known condition data points in the current data event except for the farthest condition point. Candidate nodes with consistent attribute values are selected, and the number of repetitions of the attribute value at the center position of the node is counted to calculate the local conditional probability distribution.
6. The method for accelerating and optimizing hybrid queries for search tree modeling based on Snesim, as described in claim 5, is characterized in that... The reverse query strategy also includes: If there are no candidate tree nodes that satisfy all condition point constraints, delete the current farthest condition point and re-execute the reverse query until a matching node is obtained or all condition points are deleted.
7. The method for accelerating and optimizing hybrid queries for search tree modeling based on Snesim as described in claim 1, characterized in that, The forward query strategy includes: Initialize the current search tree node as the root node; Determine whether there is a known conditional data point at the position corresponding to the next level of the search tree for the current data event; If a known conditional data point exists, only the child node with the same attribute value as that known conditional data point will be retained as the current search tree node at the next level. If no known conditional data points exist, then all child nodes of the current node are retained as candidate paths for the next level. The above judgment process is executed until a leaf node of the search tree is reached or no further matching is possible. The number of duplicate central attribute values of all retained path terminal nodes is counted.
8. The method for accelerating and optimizing hybrid queries for search tree modeling based on Snesim, as described in claim 7, is characterized in that... The forward query strategy also includes: When the number of matching paths obtained from a forward query is less than a preset threshold, a template simplification operation is performed on the data event to increase the number of matching paths.
9. A search tree hybrid query acceleration and optimization device for Snesim modeling, characterized in that, include: The search tree construction module is used to obtain training images and data templates, scan the training images using the data templates, and construct a search tree containing all data events and their repetition counts in the training images based on the Snesim method. The reverse auxiliary retrieval structure construction module is used to construct a reverse auxiliary retrieval structure based on the search tree and establish a mapping relationship between the attribute values, level depth and node index of each node in the search tree. The configuration module is used to obtain the geometric parameters and data files of the simulation mesh, initialize the simulation mesh based on the geometric parameters, allocate data to the corresponding nodes of the simulation mesh, and define random paths for accessing the simulation mesh nodes. The strategy control module is used to determine whether the current simulation progress is less than a preset progress threshold based on the number of nodes that have been traversed and assigned values on the random path. If the simulation progress is less than the progress threshold, a reverse query strategy is adopted to retrieve search tree nodes that meet the conditions using the reverse auxiliary retrieval structure and to statistically analyze the local conditional probability distribution of the nodes to be simulated. If the simulation progress is greater than or equal to the progress threshold, a forward query strategy is adopted to match data events layer by layer starting from the root node of the search tree and to statistically analyze the local conditional probability distribution of the nodes to be simulated. The probability statistics and assignment module is used to perform random sampling based on the local conditional probability distribution, assign the sampling results to the nodes to be simulated and use them as conditional data for subsequent simulations until all grid nodes have been simulated.
10. A computer-readable storage medium, characterized in that, Used to store computer-readable programs or instructions, which, when executed by a processor, are capable of implementing the steps in the hybrid query acceleration optimization method for Snesim modeling as described in any one of claims 1-8.
