Drilling accident prediction method, device and equipment based on network optimization and medium

By optimizing the BP neural network using a multi-population genetic algorithm, the problems of premature convergence and expert experience inheritance were solved, improving the accuracy and consistency of drilling accident prediction and achieving efficient drilling accident prediction.

CN119646564BActive Publication Date: 2026-01-06GUANGZHOU MARINE GEOLOGICAL SURVEY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411587473.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2026-01-06
Estimated Expiration
2044-11-08

AI Technical Summary

Technical Problem

Existing BP neural network drilling accident prediction methods based on genetic algorithms suffer from premature convergence, making it difficult to accurately predict drilling accidents in complex drilling environments. Furthermore, expert experience is difficult to pass on and replicate quickly, leading to inconsistent prediction results and insufficient accuracy.

Method used

A multi-population genetic algorithm is used to optimize the BP neural network. By initializing the population tribes, setting the evolutionary probability, performing crossover and mutation operations, and combining tribe selection operators and iterative optimization, the optimal neural network parameters are found, thereby improving the global search capability.

Benefits of technology

It improved the accuracy and consistency of drilling accident prediction, enhanced the precision of early warning, and achieved efficient drilling accident prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646564B_ABST
    Figure CN119646564B_ABST
Patent Text Reader

Abstract

The application discloses a drilling accident prediction method and device based on network optimization, equipment and medium, through multiple populations, each population evolves along different directions, the evolution in the population and the existing work remain consistent, the exchange between the populations is introduced, and the solving efficiency is improved. The application proposes a drilling accident prediction method based on BP neural network, relying on the BP neural network, the intelligent level of accident early warning is significantly enhanced; a multi-population based method is proposed to search for the optimal parameters of the BP neural network, the global search ability is enhanced, and the accuracy of the early warning is improved; the selection operator, the exchange operator and the crossover operator of the multi-population are proposed, the shortcomings of the existing genetic algorithm are improved, and the method can be widely applied to the technical field of data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, equipment and medium for predicting drilling accidents based on network optimization. Background Technology

[0002] In the field of oil and gas exploration and development, the safety and efficiency of drilling operations are directly related to the success and economic benefits of a project. Real-time monitoring of the drilling status and timely early warning of abnormal accidents are crucial for ensuring operational safety and improving drilling efficiency. However, currently widely used drilling accident prediction methods rely primarily on the subjective judgment of experts and long-accumulated field experience, which has significant limitations.

[0003] First, human judgment is influenced by various factors such as the expert's subjective bias, fatigue, and experience level, making it difficult to guarantee the accuracy and consistency of the judgment. Especially in complex and ever-changing drilling environments, the judgment of a single expert may not be able to fully and accurately reflect the drilling status, increasing the risk of misjudgment and omission.

[0004] Secondly, while the drilling field experience of experts is invaluable, its transmission and replication face significant challenges. The experiences of different experts are difficult to directly compare and integrate, and the accumulation of experience requires long-term practice and learning. This makes it difficult to replicate and apply the knowledge system for drilling accident prediction on a large scale in a short period, thus limiting the improvement of drilling operation safety levels.

[0005] To overcome the aforementioned problems, researchers have begun exploring drilling accident prediction methods based on intelligent algorithms. Among these, the BP neural network model based on genetic algorithms has attracted considerable attention due to its powerful self-learning and nonlinear mapping capabilities. However, existing BP neural network drilling accident prediction methods based on genetic algorithms still have certain shortcomings. Specifically, the single-population evolution strategy adopted by the genetic algorithm in this method is prone to premature convergence, meaning that the algorithm gets trapped in local optima too early during the search process and fails to find the global optimum. In addition, traditional selection operators, crossover operators, and mutation operators may exhibit certain limitations when dealing with complex drilling environments, failing to fully mine and utilize useful information in the data, thus affecting the accuracy and reliability of the prediction results. Summary of the Invention

[0006] This invention aims to at least partially address the limitations of related technologies. To this end, this invention proposes a drilling accident prediction method, apparatus, equipment, and medium based on network optimization, capable of efficiently and accurately predicting drilling accidents.

[0007] On one hand, embodiments of the present invention provide a drilling accident prediction method based on network optimization, including:

[0008] Drilling data is acquired, and test and validation sets are obtained based on the drilling data; the drilling data includes drilling characteristic data and drilling accident types;

[0009] A preset neural network is used as the first neural network; the network topology of the preset neural network is obtained based on the preset number of features in the drilling feature data.

[0010] Initialize a population tribe; designate the population tribe as the first tribe; the first tribe includes a first number of populations, each population includes a second number of individuals, each individual includes network parameters corresponding to the network topology of the first neural network, the second number represents random numbers within a preset interval; each population in the first tribe is set with an evolution probability, the evolution probability includes at least one of crossover probability and mutation probability.

[0011] Iterate through all individuals in each population of the first tribe, and then use the test set to obtain the first prediction accuracy corresponding to the network parameters of each individual in the first neural network; obtain the largest first prediction accuracy in the first tribe as the target accuracy. When the target accuracy is greater than the first threshold, the individual corresponding to the target accuracy is taken as the target individual. Otherwise, perform the first evolutionary processing on the corresponding population based on the evolutionary probability of each population to obtain the second tribe.

[0012] Iterate through all individuals in each population of the second tribe, and then use the test set to obtain the second prediction accuracy corresponding to the network parameters of each individual applied by the first neural network; based on the second prediction accuracy and combined with the preset tribe selection operator, select individuals from each population of the second tribe, and perform the second evolutionary process between populations on the second tribe according to the selected individuals to obtain the third tribe.

[0013] Increment the iteration count by 1; when the iteration count reaches the iteration threshold, determine the target individual based on the third tribe obtained in the last iteration; otherwise, take the third tribe as the first tribe, and then return to execute the step of traversing all individuals in each population of the first tribe; where the initial iteration count is 0;

[0014] The fourth prediction accuracy corresponding to the network parameters of the target individual is obtained by processing the validation set. When the fourth prediction accuracy is greater than the second threshold, the network parameters of the target individual are applied to the first neural network as the target neural network; otherwise, the network topology of the first neural network is adjusted to obtain the second neural network, the iteration count is reset to 0, the second neural network is used as the first neural network, and then the process returns to the step of initializing the population tribe.

[0015] Drilling accidents are predicted using a target neural network based on the drilling data to be predicted, and the drilling prediction results are obtained.

[0016] Optionally, the preset neural network includes an input layer, a hidden layer, and an output layer; the method further includes the following steps:

[0017] The first number of neurons in the input layer of the preset neural network is set according to the number of features in the drilling feature data;

[0018] Based on the first quantity, the second quantity of neurons in the hidden layer of the preset neural network is set in combination with the preset quantity relationship; wherein, the third quantity of neurons in the output layer is 1; the network parameters include weight parameters and threshold parameters.

[0019] The fourth quantity of weight parameters is determined by the sum of the product of the first and second quantities and the product of the second and third quantities; the quantity of threshold parameters is determined by the sum of the second and third quantities.

[0020] Optionally, iterate through all individuals in each population of the first tribe, and then obtain the first prediction accuracy corresponding to the network parameters of each individual in the first neural network through test set processing; obtain the largest first prediction accuracy in the first tribe as the target accuracy; when the target accuracy is greater than a first threshold, the individual corresponding to the target accuracy is taken as the target individual; otherwise, perform the first evolutionary processing on the corresponding population based on the evolutionary probability of each population to obtain the second tribe, including the following steps:

[0021] The first population in the first tribe was selected as the target population.

[0022] The first individual in the target population is used as the reserve individual;

[0023] The network parameters of the preparatory individuals are applied to the first neural network to serve as the preparatory neural network;

[0024] A preliminary neural network is used to predict all drilling feature data in the test set to obtain preliminary results. All preliminary results are compared with the drilling accident types paired with their corresponding drilling feature data, and the first prediction accuracy corresponding to the network parameters of the preliminary individuals is obtained based on the proportion of identical results.

[0025] Take the next individual in the target population as the next individual and return to execute the step of applying the network parameters of the next individual to the first neural network as the first neural network, until the first prediction accuracy of all individuals in the target population is obtained.

[0026] The highest first prediction accuracy in the target population is obtained as the target accuracy. When the target accuracy is greater than a first threshold, the individual corresponding to the target accuracy is taken as the target individual. Otherwise, the target population is subjected to a first evolutionary process based on the pre-set evolutionary probability of the target population. The first evolutionary process includes at least one of crossover and mutation operations.

[0027] Take the next population of the target population in the first tribe as the target population, and return to execute the step of taking the first individual in the target population as the preparatory individual, until the target individual or the second tribe is obtained.

[0028] Optionally, individuals are selected from each population in the second tribe based on the second prediction accuracy and a preset tribe selection operator, including the following steps:

[0029] The standard deviation of the accuracy of each population in the second tribe was obtained based on the second prediction accuracy.

[0030] The target difference value for each population in the second tribe is obtained by subtracting the first threshold from the standard deviation of the accuracy of each population in the second tribe.

[0031] The number of individuals selected in each population of the second tribe is determined by multiplying the target difference of each population in the second tribe with the second number of the corresponding population.

[0032] Based on the selection quantity, a corresponding number of individuals are obtained from the corresponding population as selected individuals;

[0033] Among them, individuals are selected from the group of individuals with the second highest prediction accuracy in each population.

[0034] Optionally, the second tribe undergoes a second evolutionary process among populations based on selected individuals, including the following steps:

[0035] Obtain the number of selections by each individual in the second tribe, and then determine the total number of selections by all populations in the second tribe;

[0036] Obtain the highest second prediction accuracy for each population in the second tribe, and then sum them up to get the total accuracy.

[0037] The acceptance ratio for each population is determined based on the ratio of the largest second prediction accuracy to the sum of accuracy rates for each population in the second tribe.

[0038] The number of people to be accepted for each population is determined by multiplying the acceptance rate of each population in the second tribe by the total number of people selected.

[0039] Based on the second prediction accuracy in descending order, all selected individuals in the second tribe are sorted to obtain the selection sequence;

[0040] Based on the order of acceptance quantity from smallest to largest, individuals selected from the preceding sequence are placed into the corresponding population in the second tribe according to the acceptance quantity.

[0041] Optionally, the second evolutionary treatment of the second tribe based on selected individuals also includes the following steps:

[0042] The first population in the second tribe was selected as the target population.

[0043] The crossover number of the target population is obtained by combining the selection and acceptance numbers of the target population with preset operating rules.

[0044] Randomly select one accepting individual from all accepting individuals placed in the target population as the first individual; randomly select one accepting individual from all accepting individuals placed in the second tribe (excluding the target population) as the second individual.

[0045] Gene crossover was performed on the first and second individuals to obtain crossover individuals;

[0046] Place the crossover individuals into the target population and increment the crossover count by 1; initialize the crossover count to 0.

[0047] Return to the step of randomly selecting one accepting individual from all accepting individuals placed in the target population as the first individual, until the crossover count equals the crossover quantity, reset the crossover count to 0, and take the next population of the target population in the second tribe as the target population;

[0048] Return to the step of selecting and accepting individuals based on the target population, and processing them according to the preset operating rules to obtain the crossover number of the target population, until all populations in the second tribe have been placed with the corresponding crossover number of individuals.

[0049] Optionally, the target individual is determined based on the third tribe obtained in the last iteration, including the following steps:

[0050] Iterate through all individuals in each population of the third tribe, and then use the test set to obtain the third prediction accuracy corresponding to the network parameters of each individual applied by the first neural network.

[0051] The individual with the highest third prediction accuracy in the third tribe is selected as the target individual.

[0052] On the other hand, embodiments of the present invention provide a drilling accident prediction device based on network optimization, comprising:

[0053] The first module is used to acquire drilling data and organize it into test and validation sets; the drilling data includes drilling characteristic data and drilling accident types;

[0054] The second module is used to use a preset neural network as the first neural network; the network topology of the preset neural network is obtained based on the number of features in the drilling feature data.

[0055] The third module is used to initialize the population tribes; the population tribes are designated as the first tribe; the first tribe includes a first number of populations, each population includes a second number of individuals, each individual includes network parameters corresponding to the network topology of the first neural network, the second number represents random numbers within a preset interval; each population in the first tribe is set with an evolution probability, the evolution probability includes at least one of crossover probability and mutation probability;

[0056] The fourth module is used to traverse all individuals of each population in the first tribe, and then obtain the first prediction accuracy corresponding to the network parameters of each individual in the first neural network through test set processing; the largest first prediction accuracy in the first tribe is obtained as the target accuracy. When the target accuracy is greater than the first threshold, the individual corresponding to the target accuracy is taken as the target individual. Otherwise, the first evolutionary processing is performed on the corresponding population based on the evolutionary probability of each population to obtain the second tribe.

[0057] The fifth module is used to traverse all individuals in each population of the second tribe, and then obtain the second prediction accuracy corresponding to the network parameters of each individual applied by the first neural network through test set processing; based on the second prediction accuracy and combined with the preset tribe selection operator, select individuals from each population of the second tribe, and perform the second evolutionary processing between populations of the second tribe according to the selected individuals to obtain the third tribe.

[0058] The sixth module is used to increment the iteration count by 1; when the iteration count reaches the iteration threshold, the target individual is determined based on the third tribe obtained from the last iteration; otherwise, the third tribe is taken as the first tribe, and then the process returns to perform the step of traversing all individuals in each population of the first tribe; where the initial iteration count is 0;

[0059] The seventh module is used to obtain the fourth prediction accuracy corresponding to the network parameters of the target individual applied to the first neural network through validation set processing. When the fourth prediction accuracy is greater than the second threshold, the network parameters of the target individual are applied to the first neural network as the target neural network; otherwise, the network topology of the first neural network is adjusted to obtain the second neural network, the iteration count is reset to 0, the second neural network is used as the first neural network, and then the process returns to execute the initialization of the population tribe.

[0060] The eighth module is used to predict drilling accidents based on the drilling data to be predicted using a target neural network, and to obtain the drilling prediction results.

[0061] Optionally, the preset neural network includes an input layer, a hidden layer, and an output layer; the device also includes:

[0062] The ninth module is used to set the first number of neurons in the input layer of the preset neural network based on the number of features in the drilling feature data.

[0063] The tenth module is used to set the second number of neurons in the hidden layer of the preset neural network based on the first number and in combination with the preset quantitative relationship; wherein, the third number of neurons in the output layer is 1; the network parameters include weight parameters and threshold parameters;

[0064] The eleventh module is used to determine the fourth quantity of weight parameters based on the sum of the product of the first quantity and the second quantity and the product of the second quantity and the third quantity; and to determine the quantity of threshold parameters based on the sum of the second quantity and the third quantity.

[0065] On the other hand, embodiments of the present invention provide an electronic device, including: a processor and a memory; the memory is used to store a program; the processor executes the program to implement the above-described network-optimized drilling accident prediction method.

[0066] On the other hand, embodiments of the present invention provide a computer storage medium storing a processor-executable program, which, when executed by a processor, is used to implement the above-described network-optimized drilling accident prediction method.

[0067] This invention, through the acquisition of drilling data, obtains a test set and a validation set based on the drilling data. The drilling data includes drilling feature data and drilling accident types. A preset neural network is used as the first neural network. The network topology of the preset neural network is preset based on the number of features in the drilling feature data. Population tribes are initialized. These population tribes are used as the first tribe. The first tribe includes a first number of populations, and each population includes a second number of individuals. Each individual includes network parameters corresponding to the network topology of the first neural network. The second number represents random numbers within a preset interval. Each population in the first tribe is set with an evolution probability, which includes at least one of crossover probability and mutation probability. All individuals in each population of the first tribe are traversed, and the first prediction accuracy corresponding to the network parameters of each individual in the first neural network is obtained through test set processing. The largest first prediction accuracy in the first tribe is obtained as the target accuracy. When the target accuracy is greater than a first threshold, the individual corresponding to the target accuracy is taken as the target individual. Otherwise, the corresponding population is subjected to a first evolutionary process based on the evolution probability of each population to obtain a second tribe. All individuals in each population of the second tribe are traversed. Individuals are processed through a test set to obtain the second prediction accuracy corresponding to the network parameters of each individual in the first neural network. Based on the second prediction accuracy and a preset tribe selection operator, selected individuals are obtained from each population in the second tribe. The second evolutionary process between populations is performed on the second tribe according to the selected individuals to obtain the third tribe. The iteration count is incremented by 1. When the iteration count reaches the iteration threshold, the target individual is determined based on the third tribe obtained in the last iteration. Otherwise, the third tribe is used as the first tribe, and the process returns to the step of traversing all individuals in each population of the first tribe. The iteration count is initially 0. The fourth prediction accuracy corresponding to the network parameters of the target individual in the first neural network is obtained through validation set processing. When the fourth prediction accuracy is greater than the second threshold, the network parameters of the target individual are applied to the first neural network as the target neural network. Otherwise, the network topology of the first neural network is adjusted to obtain the second neural network. The iteration count is reset to 0, the second neural network is used as the first neural network, and the process returns to the step of initializing the population tribes. The drilling accident is predicted by the target neural network based on the drilling data to be predicted, and the drilling prediction result is obtained. This invention is based on multiple populations, each evolving in a different direction. The evolution within each population is consistent with existing work, and communication between populations is introduced, thereby improving the solution efficiency. This invention improves the genetic algorithm to find the optimal parameters of the BP neural network, thereby obtaining a more accurate drilling accident prediction model. Specifically, this invention proposes a method based on multiple populations to search for the optimal parameters of the BP neural network, enhancing the global search capability and improving the accuracy of early warning. This invention can efficiently and accurately predict drilling accidents. Attached Figure Description

[0068] The accompanying drawings are provided to further understand the technical solutions of the present invention and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the technical solutions of the present invention, and do not constitute a limitation on the technical solutions of the present invention.

[0069] Figure 1 A schematic diagram of an implementation environment for network-optimized drilling accident prediction provided in an embodiment of the present invention;

[0070] Figure 2 A flowchart illustrating a drilling accident prediction method based on network optimization provided in an embodiment of the present invention;

[0071] Figure 3 A schematic diagram illustrating an extended process of a drilling accident prediction method based on network optimization, provided in an embodiment of the present invention;

[0072] Figure 4 A schematic diagram of the process of traversing the first tribe provided in an embodiment of the present invention;

[0073] Figure 5 A schematic diagram of the process for obtaining and selecting individuals provided in an embodiment of the present invention;

[0074] Figure 6 This is a schematic diagram of the unfolding process of the second evolutionary process provided in an embodiment of the present invention;

[0075] Figure 7 This is a schematic diagram of the extended process of the second evolutionary process provided in an embodiment of the present invention;

[0076] Figure 8 A schematic diagram illustrating the overall process principle of the network-optimized drilling accident prediction method provided in this embodiment of the invention;

[0077] Figure 9 A schematic diagram of a network-optimized drilling accident prediction device provided in an embodiment of the present invention;

[0078] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0079] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0080] It should be noted that although functional modules are divided in the system diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first / S100," "second / S200," etc., in the specification, claims, and the aforementioned figures are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0081] In this invention, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this invention can be combined with other embodiments.

[0082] It is understood that the network-optimized drilling accident prediction method provided in this embodiment of the invention can be applied to any computer device with data processing and computing capabilities, and this computer device can be various terminals or servers. When the computer device in the embodiment is a server, the server is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal can be a smartphone, tablet, laptop, or desktop computer, but it is not limited to these.

[0083] To facilitate understanding of the technical solution of this invention, the technical terms that may appear in the embodiments of this invention will first be explained:

[0084] Genetic Algorithm (GA) is a computational model that simulates the biological evolution process. It uses mechanisms such as natural selection and gene recombination to search and optimize complex problems. It has the characteristics of wide application range, strong global search capability, and easy parallel computing. It is suitable for solving various types of optimization problems, including combinatorial optimization, continuous optimization and multi-objective optimization.

[0085] A back propagation (BP) neural network is a multilayer feedforward neural network trained using an error backpropagation algorithm, and it is one of the most widely used neural network models. The BP neural network process mainly consists of two stages: the first stage is the forward propagation of the signal, from the input layer through the hidden layers, and finally to the output layer; the second stage is the backward propagation of the error, from the output layer to the hidden layers, and finally to the input layer, adjusting the weights and biases from the hidden layers to the output layer, and from the input layer to the hidden layers, in sequence.

[0086] The following section focuses on the input layer, hidden layers, and output layer of a backpropagation (BP) neural network. Input layer: The data input to the BP neural network; the number of input layers depends on the number of input variables. Hidden layer: Maps the data x from the input layer; simply put, refer to the formula... In this context, w and b are called weights and threshold parameters, respectively, and F() is the mapping rule, also known as the activation function. In other words, the hidden layer maps the input influencing factor data x, producing mapped values. There can be multiple hidden layers, and the number of neural networks in each hidden layer can be customized. Output layer: The output of the BP neural network; the number of output layers depends on the number of output variables. Simply put, refer to the formula: , where w and b are the weights and threshold parameters. Gradient descent algorithm: By calculating the deviation between the output result and the y-value input to the neural network model, the algorithm adjusts the weights and threshold parameters accordingly.

[0087] In summary, the values ​​of weight w and threshold b are very important for BP neural networks. This invention does not use the commonly used gradient descent algorithm, but instead introduces a genetic algorithm to find the optimal weight w and threshold b, thereby improving the prediction accuracy of the BP neural network. This is the main starting point of this invention.

[0088] In the oil and gas extraction industry, well leakage, well kick, and well blowout are three serious accidents related to drilling operations. They all involve the abnormal flow of underground fluids (such as water, oil, and gas) during the drilling process, but each has its own characteristics and dangers.

[0089] Loss of drilling fluid (also known as mud) refers to the accidental inflow of drilling fluid into the formation during drilling. This is usually caused by high formation permeability or improper drilling pressure control, leading to fluid loss. Loss of drilling fluid can reduce the amount of drilling fluid, affecting the cooling and cleaning capabilities of the wellbore, and may also expose the wellbore wall, increasing the risk of collapse. In severe cases, loss of drilling can hinder continued drilling and may even require special measures to seal the lost circulation zone.

[0090] A well kick occurs when underground fluid (mainly natural gas or liquids) enters the wellbore at a rate exceeding normal circulation speed, but before reaching the surface. Well kicks are usually caused by formation pressure exceeding the pressure inside the wellbore, or by insufficient drilling fluid column pressure to balance the formation pressure. If not controlled promptly, a well kick can quickly escalate into a more severe blowout. A well kick is an emergency requiring immediate action, such as increasing the drilling fluid volume and shutting off the blowout preventer (BOP), to re-establish pressure balance within the wellbore.

[0091] A blowout is one of the most serious accidents, occurring when high-pressure underground fluids (oil, gas, water, or other mixtures) are uncontrollably ejected from the wellhead and reach the surface or sea. Blowouts not only cause enormous resource losses but can also trigger catastrophic consequences such as fires, explosions, and environmental pollution, seriously threatening human safety and the environment. Blowouts typically require the immediate activation of emergency response plans, including the use of specialized well control equipment (such as blowout preventers), injection of re-drilling fluid, or cement plugs to seal and control the well.

[0092] In the past, the prediction of well leakage, well kick, and well blowout relied heavily on subjective judgments made by technicians based on real-time sensor data, requiring extensive practical experience. However, human judgment is inevitably influenced by subjective biases and has limitations. In recent years, the leap in intelligent algorithm technology has brought innovation to this field, and researchers at home and abroad have explored various methods for predicting drilling accidents using intelligent algorithms. To further prevent drilling accidents and mitigate losses caused by drilling accidents, this invention proposes an improved genetic algorithm to optimize the BP neural network model to enhance drilling prediction capabilities.

[0093] K-fold cross-validation is a commonly used technique for evaluating the performance of machine learning models. The specific process is as follows: First, the entire dataset is uniformly divided into K non-overlapping subsets (or "folds"), with each subset maintaining a consistent data distribution to ensure similar proportions of samples from each category. Next, K rounds of training and validation are performed. In each round: one subset is selected as the validation set, and the remaining K-1 subsets are combined as the test set. This process is repeated K times, resulting in K performance evaluation scores. The average of these scores is typically used as the final model evaluation metric. The advantage of K-fold cross-validation is that it makes better use of all data for training and testing, provides valuable information about model stability and reliability, and helps avoid overfitting during model selection and parameter tuning.

[0094] like Figure 1 The diagram shown is a schematic representation of an implementation environment provided by an embodiment of the invention. (Refer to...) Figure 1The implementation environment includes at least one terminal 102 and a server 101. The terminal 102 and the server 101 can be connected via a network, either wirelessly or via a wired connection, to complete data transmission and exchange.

[0095] Server 101 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0096] Additionally, server 101 can also be a node server in a blockchain network. Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms.

[0097] Terminal 102 can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. Terminal 102 and server 101 can be directly or indirectly connected via wired or wireless communication, and this embodiment of the invention does not impose any limitations.

[0098] Exemplary based on Figure 1 The implementation environment shown in this embodiment of the invention provides a drilling accident prediction method based on network optimization. The following description uses the application of this drilling accident prediction method based on network optimization in server 101 as an example. It can be understood that this drilling accident prediction method based on network optimization can also be applied in terminal 102.

[0099] Reference Figure 2 , Figure 2 The flowchart illustrates a network-optimized drilling accident prediction method applied to a server, as provided in an embodiment of the present invention. The executing entity of this network-optimized drilling accident prediction method can be any of the aforementioned computer devices (including servers or terminals). (Refer to...) Figure 2 The method includes the following steps:

[0100] S100. Obtain drilling data, and organize the data to obtain test and validation sets.

[0101] Drilling data includes drilling characteristic data and drilling accident types;

[0102] For example, in some specific implementations, obtaining the test set and the verification set can be achieved as follows:

[0103] The drilling data used in this invention mainly comes from publicly available data both domestically and internationally. Multiple sets of data records were collected from daily drilling reports, daily mud reports, and completion reports. Some data indicate drilling accidents during the drilling process, while others indicate normal drilling. Each set of data includes multiple characteristics (i.e., drilling characteristic data) such as lithology, pore size, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, drill bit speed, primary fracture direction, cement slurry density, drilling fluid density, inlet flow rate, outlet flow rate, and pump discharge rate. It also indicates whether any of the three abnormal conditions—lost circulation, well kick, or blowout—were detected under that data set.

[0104] This invention uses K-fold cross-validation to split the test set and the validation set, where K can be customized, typically around 5 to 10, and the value of K is evaluated based on the actual amount of data collected. First, K groups are obtained through K-fold cross-validation. Generally, VerifySize groups (VerifySize can be customized, typically 2) are randomly selected as the validation set, and the remaining K-VerifySize groups are used as the test set.

[0105] S200: Use the preset neural network as the first neural network;

[0106] The network topology of the preset neural network is obtained based on the preset number of features in the drilling feature data.

[0107] It should be noted that the default neural network includes an input layer, hidden layers, and an output layer; for example... Figure 3 As shown, in some embodiments, the method may further include the following steps: T100, setting a first number of neurons in the input layer of a preset neural network based on the number of features in the drilling feature data; T200, setting a second number of neurons in the hidden layer of the preset neural network based on the first number and a preset quantity relationship; wherein, the third number of neurons in the output layer is 1; the network parameters include weight parameters and threshold parameters; T300, determining a fourth number of weight parameters based on the sum of the product of the first number and the second number and the product of the second number and the third number; determining the number of threshold parameters based on the sum of the second number and the third number.

[0108] For example, in some specific implementations, determining the topology of the BP neural network can be achieved as follows:

[0109] For each set of drilling data, the data features include 15 characteristics: lithology, pore size, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, drill bit speed, primary fracture direction, cement slurry density, drilling fluid density, inlet flow rate, outlet flow rate, and pump displacement. That is, there are 15 input variables and 1 output variable (Type 1 indicates well leakage, Type 2 indicates well kick, Type 3 indicates well kick, and Type 0 indicates normal or other conditions). In other words, the BP neural network has 15 input layers and 1 output layer.

[0110] This invention uses a three-layer backpropagation (BP) neural network with the sigmoid activation function, and the number of hidden layers is [not specified]. and the number of neurons in the input layer There is an approximate relationship between them, as shown in the following formula:

[0111] ;

[0112] Therefore, the BP neural network topology has 15 input layers, 31 hidden layers, and 1 output layer. At this time, there are a total of 15*31+31*1=496 weight parameters w to be optimized and a total of 31+1=32 threshold parameters b to be optimized. That is, the genetic algorithm searches for a total of 496+32=528 optimization variables.

[0113] When the BP neural network topology was first built, it was 15-31-1. Later, when the network topology needed to be reset, the number of hidden layers... Random adjustments will be made. The adjustment formula is as follows, where... This represents a random integer value in the range [1, 10], which means that several neural network units will be added each time, thereby improving the prediction accuracy of the BP neural network.

[0114] ;

[0115] S300, Initialize the population tribe; set the population tribe as the first tribe;

[0116] The first tribe includes a first number of populations, each population includes a second number of individuals, each individual includes network parameters corresponding to the network topology of the first neural network, and the second number represents random numbers within a preset interval; each population of the first tribe is set with an evolution probability, the evolution probability includes at least one of crossover probability and mutation probability.

[0117] For example, in some specific implementations, initializing the population tribe can be achieved as follows:

[0118] A tribe is composed of multiple populations, and a population is composed of multiple individuals. Each individual has multiple genes, which represent the weight parameters w and threshold parameters b of a backpropagation (BP) neural network. Setting up multiple populations is to control the evolution of the entire tribe in different directions. If the population size and evolutionary rules of multiple populations are exactly the same, then multiple populations are no different from a single large population. Therefore, it is necessary to first clarify the size, evolutionary rules, and individual initialization rules of different populations.

[0119] First, there's the population size, SizePop. The size varies between different populations, and the initialization rules are as follows: MinPop represents the number of individuals in population i, MinPop represents the minimum population size (customizable based on experience), and MaxPop represents the maximum population size.

[0120] Population size (customizable based on experience), generally speaking, MinPop and MaxPop satisfy the following relationship: .

[0121] ;

[0122] Secondly, there are the population evolution rules, which mainly serve as evolutionary references for each population. These include parameters such as the crossover operator probability (crossoverRate) and the mutation operator probability (mutationRate). These are essentially the parameters of various operators in a genetic algorithm based on a single population. Because crossover and mutation are different evolutionary mechanisms, and the values ​​of each probability are determined empirically, they do not perform well when facing more complex problems, meaning they cannot find the optimal solution. Therefore, this invention introduces multiple populations, each evolving in a different direction based on different evolutionary rules.

[0123] Finally, there's the individual initialization rule. After determining the size of each population, each population is traversed to initialize the individuals within that population. Assume the current BP neural network topology has 20 input layers and [missing information - likely a number of hidden layers]. There are 1 output layer and 1 output layer, so the total number of weight parameters w to be optimized is... There are a total of [number] threshold parameters b to be optimized. Generally speaking, the weight w and the threshold b are both in the range of [-1, 1], but can be adjusted flexibly according to the actual situation.

[0124] The formula for individual initialization is as follows, where Let j represent individual j in the i-th population. This represents the k-th gene of individual j in the i-th population, and similarly... Let m represent the m-th gene of individual j in the i-th population, and normal(0,1) represent a normal distribution with a mean of 0 and a standard deviation of 1.

[0125] ;

[0126] ;

[0127] ;

[0128] In general, tribe initialization is about defining the population size, evolutionary rules, and the initialization of all individuals.

[0129] S400. Traverse all individuals in each population of the first tribe, and then obtain the first prediction accuracy corresponding to the network parameters of each individual in the first neural network through test set processing; obtain the largest first prediction accuracy in the first tribe as the target accuracy. When the target accuracy is greater than the first threshold, take the individual corresponding to the target accuracy as the target individual. Otherwise, perform the first evolution processing on the corresponding population based on the evolution probability of each population to obtain the second tribe.

[0130] It should be noted that in some embodiments, such as Figure 4 As shown, step S400 may include the following steps: S401, taking the first population in the first tribe as the target population; S402, taking the first individual in the target population as a preparatory individual; S403, applying the network parameters of the preparatory individual to the first neural network as a preparatory neural network; S404, using the preparatory neural network to perform prediction processing on all drilling feature data in the test set to obtain preparatory results; comparing all preparatory results with the drilling accident types paired with their corresponding drilling feature data, and obtaining the first prediction accuracy corresponding to the network parameters of the preparatory individual based on the proportion of identical results; S405, taking the next individual in the target population as a preparatory individual, and returning to the execution... The steps of applying the network parameters of the preparatory individuals to the first neural network as the preparatory neural network are repeated until the first prediction accuracy of all individuals in the target population is obtained; S406, the largest first prediction accuracy in the target population is obtained as the target accuracy. When the target accuracy is greater than the first threshold, the individual corresponding to the target accuracy is taken as the target individual. Otherwise, the target population is subjected to the first evolutionary processing based on the preset evolutionary probability of the target population. The first evolutionary processing includes at least one of crossover operation and mutation operation; S407, the next population of the target population in the first tribe is taken as the target population, and the steps of taking the first individual in the target population as the preparatory individual are repeated until the target individual or the second tribe is obtained.

[0131] The subsequent methods for compiling the second, third, and fourth prediction accuracy rates are similar to the process logic of S404 mentioned above, and will not be repeated hereafter.

[0132] For example, in some specific implementations, the prediction accuracy is first calculated based on a BP neural network, which can be implemented as follows:

[0133] Iterate through each individual in the current i-th population and calculate the corresponding accuracy. Each individual represents the weight w and threshold b of the BP neural network, meaning each individual represents a BP neural network. Based on each individual, iterate through each array of the test set, input it into the BP neural network model, obtain the prediction result, and then compare it with the true result. This invention uses prediction accuracy (Precision) as the fitness function for evaluation. Precision is between [0,1], and a higher score indicates better model performance. The calculation formula is as follows: Where TrueSize represents the number of correct predictions, and TestSetSize represents the number of test set data.

[0134] ;

[0135] Simultaneously record the best-performing individual in the current population. :

[0136] ;

[0137] Then, determine whether there are individuals exceeding the threshold. The corresponding precision meets the requirements, that is If the optimal individual has been found, the target individual will be output directly; otherwise, subsequent steps will be executed. Here, TargetPrecision (i.e., the first threshold) is between [0,1], with a custom value; the default is 0.99.

[0138] Subsequently, if all populations of the tribe have been traversed, meaning that each population has undergone an independent evolution, then step S500 is executed to perform inter-population evolution; otherwise, the (i+1)th population of the tribe is traversed.

[0139] Specifically, evolution within the population is achieved through selection, crossover, and mutation operators. Specifically, for a population that has completed traversal but has not found the target individual, evolution within the population is carried out based on the current population's evolutionary rules (parameters such as crossover operator probability crossoverRate and mutation operator probability mutationRate). For a single population, probability-based evolutionary operations can be implemented using conventional genetic algorithms. This part is not the core of this invention, so it will not be elaborated further.

[0140] S500: Traverse all individuals in each population of the second tribe, and then obtain the second prediction accuracy corresponding to the network parameters of each individual in the first neural network through test set processing; based on the second prediction accuracy and combined with the preset tribe selection operator, select individuals from each population of the second tribe, and perform the second evolutionary processing between populations on the second tribe according to the selected individuals to obtain the third tribe.

[0141] It should be noted that in some embodiments, such as Figure 5 As shown, the process of selecting individuals from each population in the second tribe based on the second prediction accuracy and a preset tribe selection operator may include the following steps: S501, processing the second prediction accuracy to obtain the accuracy standard deviation of each population in the second tribe; S502, subtracting the accuracy standard deviation of each population in the second tribe from the first threshold to obtain the target difference value of each population in the second tribe; S503, determining the selection quantity of each population in the second tribe based on the product of the target difference value of each population in the second tribe and the second quantity of the corresponding population; S504, based on the selection quantity, obtaining the corresponding number of individuals from the corresponding population as selected individuals; wherein, the selected individuals are the batch of individuals with the highest second prediction accuracy in each population.

[0142] For example, in some specific implementations, the selection of individuals can be calculated based on the tribe selection operator (i.e., individual selection), which can be implemented as follows:

[0143] The tribe selection operator iterates through each population within the tribe, selecting a subset of individuals to participate in the tribe's evolutionary process based on the performance of each population. Currently, the excellence of an individual is evaluated using prediction accuracy (Precision), while the excellence of the entire population is evaluated by analyzing the distribution of prediction accuracy. The formula is as follows:

[0144] ;

[0145] ;

[0146] ;

[0147] in, This represents the average prediction accuracy of population i. The standard deviation of the prediction accuracy for population i is represented by the standard deviation of the prediction accuracy for population i. It refers to the individuals selected from population i.

[0148] Standard error of the population The smaller the value, the lower the quality of the population, indicating that the individuals in the population are more dispersed and their gene expression is richer, so more individuals should be selected. Similarly, the standard error of the population... The larger the value, the higher the quality of the population, indicating that the individuals in the population are clustered and their gene expression is concentrated, so fewer individuals should be selected. From another perspective, a tribe is similar to a nation. The larger the number of countries, the stronger they are, and the fewer students they send abroad to study. The smaller the number, the weaker the country, and the more people study abroad.

[0149] In general, each population identifies and selects matching individuals for exchange based on its own merit, and subsequent exchanges and crossovers are all based on these individuals.

[0150] In some embodiments, such as Figure 6 As shown, the second evolutionary process between populations in the second tribe based on selected individuals can include the following steps: S505, obtaining the number of selected individuals in each population of the second tribe, and thus determining the total number of selections for all populations in the second tribe; S506, obtaining the maximum second prediction accuracy for each population in the second tribe, and then summing the accuracy rates; S507, determining the acceptance ratio for each population based on the ratio of the maximum second prediction accuracy to the sum of accuracy rates for each population in the second tribe; S508, determining the number of individuals to be accepted for each population based on the product of the acceptance ratio and the total number of selections for each population in the second tribe; S509, sorting all selected individuals in the second tribe in descending order of second prediction accuracy to obtain a selection sequence; S510, according to the order of the number of individuals to be accepted from the beginning of the selection sequence, taking the selected individuals of the number of individuals to be accepted and placing them into the corresponding populations in the second tribe.

[0151] For example, in some specific implementations, multiple group individual exchanges can be performed based on the tribal exchange operator, which can be implemented as follows:

[0152] Individual exchange is essentially the direct exchange of individuals between two populations. For example, if individual A belongs to population 1 and individual B belongs to population 2, after exchanging A and B, individual A belongs to population 2 and individual B belongs to population 1.

[0153] How can individual exchange be performed between multiple populations? The calculation formula is as follows:

[0154] ;

[0155] Where N represents the population size, This represents the sum of the number of individuals selected for evolution in this round. This represents the optimal prediction accuracy for population i.

[0156] Optimal prediction accuracy The larger the size, the more individuals need to be included, and the optimal prediction accuracy will be achieved. The smaller the tribe, the fewer individuals it needs to accommodate. To put it another way, a tribe is similar to a nation. The larger the number, the stronger the country, and the more students will study in that country. The smaller the number, the weaker the country, and the fewer people will study in that country.

[0157] After determining the number of individuals each individual needs to accept, all populations are arranged according to... Sort by size from largest to smallest, each population is ranked according to its number. Individuals are selected and then included in the population.

[0158] In some embodiments, such as Figure 7 As shown, the second evolutionary process between populations in the second tribe, based on the selected individuals, may further include the following steps: S511, taking the first population in the second tribe as the target population; S512, obtaining the crossover number of the target population based on the selection and acceptance numbers of the target population, combined with preset operating rules; S513, randomly selecting one accepting individual from all accepting individuals placed in the target population as the first individual, and randomly selecting one accepting individual from all accepting individuals placed in the second tribe from all other populations besides the target population as the second individual; S514, performing gene crossover processing on the first individual and the second individual. S515. Obtain the crossover individual; S516. Place the crossover individual into the target population and increment the crossover count by 1; initialize the crossover count to 0; S517. Return to the step of randomly selecting one accepting individual from all accepting individuals placed into the target population as the first individual, until the crossover count equals the crossover quantity, reset the crossover count to 0, and take the next population of the target population in the second tribe as the target population; S518. Return to the step of processing the crossover quantity of the target population based on the selection quantity and acceptance quantity of the target population, combined with the preset running rules, until all populations in the second tribe have placed the corresponding number of crossover individuals.

[0159] For example, in some specific implementations, after realizing the exchange of individuals from multiple populations, population balancing can also be performed based on the tribal crossover operator, which can be implemented as follows:

[0160] This is mainly to address the issue of individual population loss, replenish the number of lost individuals, and ensure a relatively dynamic balance within the entire tribe's population. The calculation process for the number of exchanges in population i is as follows.

[0161] if This indicates an increase in population size. The formula for calculating the crossover number is as follows:

[0162] ;

[0163] if This indicates a decrease in population size. The formula for calculating the crossover number is as follows:

[0164] ;

[0165] In general, the more individuals a population loses, the more individuals it can replenish through the crossover operator. After the previous steps of exchanging individuals, two individuals are randomly selected and crossover is used to calculate a new individual, which is then added to the population to replenish its numbers.

[0166] S600, Increment the iteration count by 1; when the iteration count reaches the iteration threshold, determine the target individual based on the third tribe obtained in the last iteration; otherwise, take the third tribe as the first tribe, and then return to execute the step of traversing all individuals in each population of the first tribe;

[0167] The initial number of iterations is 0.

[0168] It should be noted that, in some embodiments, determining the target individual based on the third tribe obtained in the last iteration may include the following steps: traversing all individuals in each population of the third tribe, and then processing the test set to obtain the third prediction accuracy corresponding to the network parameters of each individual applied by the first neural network; and taking the individual with the largest third prediction accuracy in the third tribe as the target individual.

[0169] For example, in some specific implementations, steps S400 to S600 are multiple external evolutionary cycles, with the iteration count incremented by one each time they are executed. If the iteration count exceeds the maximum value MaxGenCnt (i.e., the iteration threshold, which can be customized and is 20 by default), proceed to step 12; otherwise, return to step S400. Each time this step is reached, it indicates that the tribe first experienced internal evolution (step S400) and then inter-population evolution (steps S400 to S600).

[0170] Find the optimal parameters for the backpropagation (BP) neural network. Reaching this step completes the entire genetic algorithm process, indicating that the optimal parameters have been obtained. :

[0171] ;

[0172] S700: The fourth prediction accuracy corresponding to the network parameters of the target individual applied to the first neural network is obtained through validation set processing. When the fourth prediction accuracy is greater than the second threshold, the network parameters of the target individual are applied to the first neural network as the target neural network; otherwise, the network topology of the first neural network is adjusted to obtain the second neural network, the iteration count is reset to 0, the second neural network is used as the first neural network, and then the process returns to the step of initializing the population tribe.

[0173] For example, in some specific implementations, a test set is obtained in step S100. In step S200, the BP network topology is defined. In step S600, the optimal parameters are obtained, i.e., the neural network weights w and threshold b are adjusted to their optimal values. With the validation set data, the drilling accident prediction BP neural network model is ready. Then, the prediction accuracy is calculated based on the BP neural network; specifically, the optimal drilling accident prediction BP neural network model has now been obtained. Each array group of the validation set is traversed, input into the BP neural network model, and the prediction result is obtained. This result is then compared with the actual result, and finally, the prediction accuracy is calculated.

[0174] Specifically, steps S200 to S700 are the update loop of the BP neural network. Whenever a BP neural network model that matches the expected drilling accident prediction is not found, the process restarts (resets the BP neural network). The entire process only ends when the desired model is found. TargetPrecision (representing the second threshold, which can be the same as the first threshold) is a value in the range [0,1], which can be customized, with a default value of 0.99. It is used to determine the optimal model, and the logic is as follows:

[0175] if If the result is positive, it means that the verification result meets expectations, that is, the BP neural network model for drilling accident prediction meets expectations, and the entire process is complete.

[0176] if If the verification results do not meet expectations, it means that there is still room for optimization in the BP neural network model for drilling accident prediction. At this time, proceed to step S200 to update the BP neural network topology (the update rules refer to the previous explanation of the random adjustment of the hidden layer, which will not be repeated here). You can also reset the relevant parameters of the genetic algorithm (which can be manually adjusted) and find the optimal parameters again. The whole process starts again.

[0177] S800: Based on the drilling data to be predicted, the target neural network performs drilling accident prediction and obtains the drilling prediction result.

[0178] For example, in some specific implementations, when this step is reached, it indicates that the drilling accident prediction BP neural network model is performing as expected, the entire process is complete, and the constructed drilling accident prediction BP neural network model can be applied to predict drilling accidents.

[0179] To explain in detail the principle of the technical solution of the present invention, the overall process of the present invention will be described below with reference to some specific embodiments. It is easy to understand that the following is an explanation of the technical principle of the present invention and should not be regarded as a limitation of the present invention.

[0180] First, it should be noted that current technical solutions rely on subjective judgments made by experts based on real-time sensor data, combined with long-term accumulated drilling field experience, to determine drilling status and trigger alarms for abnormal events. However, human judgment is inevitably influenced by subjective biases and has significant limitations. Furthermore, the relevant experience and knowledge are difficult to replicate and apply on a large scale.

[0181] In existing BP neural network drilling accident prediction methods based on genetic algorithms, the genetic algorithm adopts a single population evolution strategy and uses traditional selection operators, crossover operators, and mutation operators.

[0182] Existing methods for predicting drilling accidents using BP neural networks based on genetic algorithms have the following shortcomings:

[0183] 1) Slow BP neural network model updates: In existing methods, the model updates are slow, which affects the user experience.

[0184] 2) Low computational, search, and solution efficiency: Existing methods suffer from low search efficiency and are prone to getting trapped in local optima.

[0185] 3) Real-time prediction of drilling accidents: With the explosive growth of data volume and the rapid expansion of data dimensions, current methods are difficult to support real-time prediction.

[0186] The core of existing work is to complete population evolution based on a single population using crossover and mutation operators.

[0187] Therefore, the core of this invention is that it is based on multiple populations, each evolving in a different direction. The evolution within each population is consistent with existing work, and communication between populations is introduced, thereby improving solution efficiency. For example... Figure 8 As shown, the present invention can be implemented through the following process steps:

[0188] Step 1: Obtain the test and validation sets. The drilling data used in this invention mainly comes from publicly available data both domestically and internationally. Multiple sets of data records are collected from daily drilling reports, daily mud reports, and completion reports. Some data indicate drilling accidents during the drilling process, while others indicate normal drilling. Each set of data includes multiple characteristics such as lithology, pore size, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, drill bit speed, primary fracture direction, cement slurry density, drilling fluid density, inlet flow rate, outlet flow rate, and pump discharge rate, as well as whether three abnormal conditions—lost circulation, kick, and blowout—were detected under that data set.

[0189] This invention uses K-fold cross-validation to split the test set and the validation set, where K can be customized, typically around 5 to 10, and the value of K is evaluated based on the actual amount of data collected. First, K groups are obtained through K-fold cross-validation. Generally, VerifySize groups (VerifySize can be customized, typically 2) are randomly selected as the validation set, and the remaining K-VerifySize groups are used as the test set.

[0190] Step 2: Update the BP network topology. This step mainly involves two things: resetting the parameters of the genetic algorithm and updating the BP network topology.

[0191] First, reset the parameters related to the genetic algorithm, including resetting the number of inner loop iterations to 0, resetting the current population, etc.

[0192] The following determines the BP neural network topology. For each set of drilling data, the data features include 15 characteristics: lithology, pore size, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, drill bit speed, original fracture direction, cement slurry density, drilling fluid density, inlet flow rate, outlet flow rate, and pump displacement. That is, there are 15 input variables and 1 output variable (Type 1 represents well leakage, Type 2 represents well kick, Type 3 represents well kick, and Type 0 represents normal or other conditions). In other words, the BP neural network has 15 input layers and 1 output layer.

[0193] This invention uses a three-layer backpropagation (BP) neural network with the sigmoid activation function, and the number of hidden layers is... and the number of neurons in the input layer There is an approximate relationship between them, as shown in the following formula:

[0194] ;

[0195] Therefore, the BP neural network topology has 15 input layers, 31 hidden layers, and 1 output layer. At this time, there are a total of 15*31+31*1=496 weight parameters w to be optimized and a total of 31+1=32 threshold parameters b to be optimized. That is, the genetic algorithm searches for a total of 496+32=528 optimization variables.

[0196] The first time step 2 is executed, the network topology is 15-31-1. The number of hidden layers increases with each subsequent execution of step 2. Random adjustments will be made. The adjustment formula is as follows, where... This represents a random integer value in the range [1, 10], which means that several neural network units will be added each time, thereby improving the prediction accuracy of the BP neural network.

[0197] ;

[0198] Step 3: Initialize the entire tribe. A tribe consists of multiple populations, and a population consists of multiple individuals. Each individual has multiple genes, which represent the weight parameters w and threshold parameters b of a backpropagation (BP) neural network. Setting up multiple populations is to control the entire tribe's evolution in different directions. If the population size and evolutionary rules of multiple populations are exactly the same, then multiple populations are no different from a single large population. Therefore, it is necessary to first clarify the size, evolutionary rules, and individual initialization rules of different populations.

[0199] First, there's the population size, SizePop. The size varies between different populations, and the initialization rules are as follows: MinPop represents the number of individuals in population i, while MaxPop represents the minimum population size (which can be customized based on experience).

[0200] Population size (customizable based on experience), generally speaking, MinPop and MaxPop satisfy the following relationship: .

[0201] ;

[0202] Secondly, there are the population evolution rules, which mainly serve as evolutionary references for each population. These include parameters such as the crossover operator probability (crossoverRate) and the mutation operator probability (mutationRate). These are essentially the parameters of various operators in a genetic algorithm based on a single population. Because crossover and mutation are different evolutionary mechanisms, and the values ​​of each probability are determined empirically, they do not perform well when facing more complex problems, meaning they cannot find the optimal solution. Therefore, this invention introduces multiple populations, each evolving in a different direction based on different evolutionary rules.

[0203] Here's an example: Suppose we have three populations, A, B, C, and D, with the following parameters:

[0204] Population A: crossover probability (crossoverRate) is 1.0, mutation probability (mutationRate) is 0. This population mainly uses the crossover operator to obtain the best individuals, and the evolutionary direction is mainly crossover.

[0205] Population B: The crossover probability (crossoverRate) is 0.5 and the mutation probability (mutationRate) is 0.5. This population mainly uses crossover and mutation operators to obtain the best individuals, and the evolutionary direction is equal probability evolution of crossover and mutation.

[0206] Population C: The crossover probability (crossoverRate) is 0.8 and the mutation probability (mutationRate) is 0.2. This population mainly uses crossover and mutation operators to obtain the best individuals, and the evolutionary direction is mainly crossover with mutation as a secondary method.

[0207] Population D: The crossover probability (crossoverRate) is 0 and the mutation probability (mutationRate) is 1. This population mainly uses the mutation operator to obtain the best individuals, and the evolutionary direction is mainly mutation.

[0208] Generally speaking, each tribe has at least three populations: those dominated by crossover, those dominated by mutation, and those combining crossover and mutation. The specific number of populations is determined based on practical experience, usually between [10, 20]. The evolutionary rules of each population are also different, and the values ​​are determined based on experience. In short, it is required that some populations be dominated by mutation, some by crossover, and some by a combination of both. The biggest advantage of doing this is to leverage the strengths and avoid the weaknesses of different operators, thereby improving the efficiency and accuracy of finding the optimal parameters.

[0209] Finally, there's the individual initialization rule. After determining the size of each population, each population is traversed to initialize the individuals within that population. Assume the current BP neural network topology has 20 input layers and [missing information - likely a number of hidden layers]. There are 1 output layer and 1 output layer, so the total number of weight parameters w to be optimized is... There are a total of [number] threshold parameters b to be optimized. Generally speaking, the weight w and the threshold b are both in the range of [-1, 1], but can be adjusted flexibly according to the actual situation.

[0210] The formula for individual initialization is as follows, where Let j represent individual j in the i-th population. This represents the k-th gene of individual j in the i-th population, and similarly... Let m represent the m-th gene of individual j in the i-th population, and normal(0,1) represent a normal distribution with a mean of 0 and a standard deviation of 1.

[0211] ;

[0212] ;

[0213] ;

[0214] In summary, tribe initialization involves defining the population size, evolutionary rules, and the initialization of all individuals. In step 1, the test set was obtained; in step 2, the topology of the BP neural network was defined; in step 3, population initialization was completed; with the test set data, the drilling accident prediction BP neural network model is ready. Proceed to step 4.

[0215] Step 4: Calculate the prediction accuracy based on the BP neural network. Iterate through each individual in the current i-th population and calculate the corresponding accuracy. Each individual represents the BP neural network weight w and threshold b, meaning each individual represents a BP neural network. Based on each individual, iterate through each array in the test set, inputting it into the BP neural network model to obtain the prediction result, and then compare it with the true result. This invention uses prediction accuracy (Precision) as the fitness function for evaluation. Precision is between [0,1], with a higher score indicating better model performance. The calculation formula is as follows: Where TrueSize represents the number of correctly predicted values. TestSetSize represents the number of test set data.

[0216] ;

[0217] Simultaneously record the best-performing individual in the current population. Proceed to step 5.

[0218] ;

[0219] Step 5: There are individuals larger than the threshold. If The corresponding precision meets the requirements, that is If the optimal individual has been found, proceed to step 12; otherwise, proceed to step 6. Here, TargetPrecision is between [0,1], with a custom value; the default is 0.99.

[0220] Step 6: Traverse the entire tribe. If all populations in the tribe have been traversed, meaning each population has undergone an independent evolution, proceed to Step 8 to facilitate inter-population communication. Otherwise, continue traversing the (i+1)th population of the tribe and proceed to Step 7.

[0221] Step 7: Evolution within the population is completed through selection, crossover, and mutation operators. For the current population, evolution is performed based on its evolutionary rules (crossover probability, mutation probability, etc.). This part is not the core of this invention, so it will not be elaborated further. Steps 4 to 7 constitute the evolutionary cycle within a single population. Proceed to Step 4.

[0222] Step 8: Select individuals based on the tribe selection operator. The tribe selection operator iterates through each population within the tribe and selects a subset of individuals to participate in the tribe's evolutionary process based on the performance of each population. Currently, the excellence of an individual is evaluated using prediction accuracy (Precision), while the excellence of the population is evaluated by analyzing the distribution of prediction accuracy (Precision). The formula is as follows:

[0223] ;

[0224] ;

[0225] ;

[0226] in, This represents the average prediction accuracy of population i. The standard deviation of the prediction accuracy for population i is represented by the standard deviation of the prediction accuracy for population i. It refers to the individuals selected from population i.

[0227] Standard error of the population The smaller the value, the lower the quality of the population, indicating that the individuals in the population are more dispersed and their gene expression is richer, so more individuals should be selected. Similarly, the standard error of the population... The larger the value, the higher the quality of the population, indicating that the individuals in the population are clustered and their gene expression is concentrated, so fewer individuals should be selected. From another perspective, a tribe is similar to a nation. The larger the number of countries, the stronger they are, and the fewer students they send abroad to study. The smaller the number, the weaker the country, and the more people study abroad.

[0228] In summary, each population identifies and selects matching individuals for exchange based on its own merit. Subsequent exchanges and crossovers are all based on these individuals. Proceed to step 9.

[0229] Step 9: Perform individual exchange between multiple populations based on the tribal exchange operator. Individual exchange is essentially the direct exchange of individuals between two populations. For example, if individual A belongs to population 1 and individual B belongs to population 2, after exchanging A and B, individual A belongs to population 2 and individual B belongs to population 1.

[0230] How can individual exchange be performed between multiple populations? The calculation formula is as follows:

[0231] ;

[0232] Where N represents the population size, This represents the sum of the number of individuals selected for evolution in this round. This represents the optimal prediction accuracy for population i.

[0233] Optimal prediction accuracy The larger the size, the more individuals need to be included, and the optimal prediction accuracy will be achieved. The smaller the tribe, the fewer individuals it needs to accommodate. To put it another way, a tribe is similar to a nation. The larger the number, the stronger the country, and the more students will study in that country. The smaller the number, the weaker the country, and the fewer people will study in that country.

[0234] After determining the number of individuals each individual needs to accept, all populations are arranged according to... Sort by size from largest to smallest, each population is ranked according to its number. Individuals are selected and then included in the population.

[0235] Here's an example: Suppose there are three populations, A, B, and C. Using the formula above, we can obtain:

[0236] Exchange of population A 3, Accept The number of individuals in population A increased by 4 after the exchange, which was 7.

[0237] Population B Exchange 5, Accept The number of individuals in population B increased by 1 after the exchange, which is now 6.

[0238] Population C exchange 7, Accept The number of individuals in population C decreased by 5 after the exchange, which is 2.

[0239] From the above, we can conclude that a total of 3 + 5 + 7 = 15 individuals participated in the exchange. Assuming... The order from smallest to largest is C, B, A.

[0240] First, select individuals for population C. Since C needs to accept 2 individuals, randomly select 2 individuals from these 15 individuals to enter population C. Then, select from the remaining 13 individuals, giving 6 to population B, and finally giving the rest to population A.

[0241] As the examples above show, the lower the population's quality, the more individuals are exchanged out and the fewer individuals are accepted. Conversely, the higher the population's quality, the fewer individuals are exchanged out and the more individuals are accepted. This means that the number of high-quality individuals in a population increases while the number of low-quality individuals decreases, which disrupts the population balance between different populations. However, this problem will be addressed in step 10.

[0242] In summary, each population identifies and selects individuals to accept based on its own merit, thus completing the exchange between populations. Proceed to step 10.

[0243] Step 10: Perform population balancing based on the tribal crossover operator. This is mainly to address the issue of individual population loss, replenish the number of lost individuals, and ensure the relative dynamic balance of the entire tribe's population. The calculation process for the number of exchanges in population i is as follows.

[0244] if This indicates an increase in population size. The formula for calculating the crossover number is as follows:

[0245] ;

[0246] if This indicates a decrease in population size. The formula for calculating the crossover number is as follows:

[0247] ;

[0248] In general, the more individuals a population loses, the more individuals it can replenish through the crossover operator. Following the exchange completed in step 10, two individuals are randomly selected and crossover is used to calculate new individuals; these new individuals are then added to the population to replenish its numbers.

[0249] Here's an example: Suppose there are three populations, A, B, and C. Using the formula above, we can obtain:

[0250] Exchange of population A 3, Accept The value is 7. Calculations show that population A has a [missing value]. =1;

[0251] Population B Exchange 5, Accept The value is 6. Calculations show that population B has... It is 2;

[0252] Population C exchange 7, Accept The value is 2. Calculations show that population C has a [missing value]. It is 8;

[0253] That is, population A has 1 crossover opportunity, population B has 2 crossover opportunities, and population C has 8 crossover opportunities.

[0254] Taking a crossover in population A as an example, one individual is randomly selected from the seven individuals received from population A (assuming the randomly selected individual is...). Then, one individual is randomly selected from the accepted individuals of other populations (assuming an individual is selected from population B). ):

[0255] ;

[0256] ;

[0257] and New individuals were obtained after crossbreeding. The calculation formula is as follows:

[0258] ;

[0259] in Indicates the addition of a new individual The kth gene, Represents an individual The kth gene, Represents an individual The k-th gene, and `random()` represents selecting a random value within a specified range. The newly obtained individual... It joins population A. The crossover process for other populations is similar and will not be described in detail here.

[0260] It's worth noting that as the populations continue to evolve, the number of individuals in each population may increase. The excess individuals are eliminated by the selection operator in step 7, so the population size in each generation still maintains a basic dynamic balance.

[0261] Compared to the evolutionary process within a population, the evolutionary process between populations emphasizes the exchange of individuals. After the exchange, the individuals will evolve along the direction of their respective populations. By repeating this process, the possibility of superior populations finding the optimal solution is continuously increased.

[0262] To put it another way, through the evolutionary process between populations, superior populations usually become even more superior, but their genetic diversity decreases. Less viable populations may become better or worse after incorporating new individuals, but they still have value and meaning—that is, maintaining genetic diversity. Less viable populations are essentially used for trial and error, continuously contributing to the evolution of superior populations. Empirically, populations primarily driven by mutation often perform poorly, but these populations have great potential for genetic diversity and cross-pollination, somewhat similar to hybrid rice.

[0263] In summary, each population dynamically calculates the number of exchanges based on the number of individuals lost from the current population, and then adds new individuals through the crossover operator, thereby ensuring a relative dynamic balance in population size. Proceed to step 11.

[0264] Step 11: Satisfy the maximum number of population iterations. Steps 4 to 11 are multiple external evolutionary loops. Each execution increments the iteration count by one. If the number of iterations exceeds the maximum value MaxGenCnt (i.e., the iteration threshold, which can be customized, with a default value of 20), proceed to step 12; otherwise, proceed to step 4.

[0265] Each time you reach this point, it means that the tribe first underwent internal evolution (steps 4 to 7), and then underwent inter-species evolution (steps 4 to 11).

[0266] Step 12: Find the optimal BP neural network parameters. Reaching this step completes the entire genetic algorithm process, indicating that the optimal parameters have been obtained. :

[0267] ;

[0268] Step 13: Initialize the BP neural network parameters. In Step 1, the test set was obtained. In Step 2, the BP network topology was defined. In Step 12, the optimal parameters were obtained. This means that the neural network weights w and threshold b have been adjusted to their optimal values. The BP neural network model for drilling accident prediction is now ready for the validation set data.

[0269] Step 14: Calculate the prediction accuracy based on the BP neural network. At this point, the optimal BP neural network model for drilling accident prediction has been obtained. Iterate through each group of the validation set, input it into the BP neural network model, obtain the prediction results, compare them with the actual results, and finally calculate the prediction accuracy. .

[0270] It should be noted that step 5 calculates based on the test set. However, this calculation is based on the validation set. .

[0271] Step 15: Classification accuracy meets requirements. Steps 2 to 15 constitute the update loop of the BP neural network. It restarts whenever a BP neural network model that matches the expected drilling accident prediction is not found. The entire process ends only when the desired model is found. TargetPrecision is a value in the range [0,1], which can be customized, with a default value of 0.99. It is used to determine the optimal model, and the logic is as follows:

[0272] if If the result is positive, it means that the verification result meets expectations, that is, the BP neural network model for drilling accident prediction meets expectations. At this point, proceed to step 16, and the entire process is complete.

[0273] if If the result is not as expected, it means that the BP neural network model for drilling accident prediction still has room for optimization. At this point, proceed to step 2, reset the relevant parameters of the genetic algorithm, update the topology of the BP neural network, and search for the optimal parameters again. The entire process starts again.

[0274] Step 16: Find the optimal BP neural network model. Reaching this step indicates that the BP neural network model for drilling accident prediction is meeting expectations, and the entire process is complete.

[0275] In summary, this invention proposes an optimized BP neural network method for predicting drilling accidents. By improving the genetic algorithm to find the optimal parameters of the BP neural network, a more accurate drilling accident prediction model is obtained. The method includes:

[0276] 1) A drilling accident prediction method based on BP neural network is proposed, which significantly enhances the intelligence level of accident early warning by relying on BP neural network.

[0277] 2) A multi-group-based method was proposed to search for the optimal parameters of the BP neural network, which enhanced the global search capability and improved the accuracy of the early warning.

[0278] 3) Multiple selection operators, exchange operators, and crossover operators for various populations are proposed to improve the shortcomings of existing genetic algorithms.

[0279] On the other hand, such as Figure 9 As shown, this embodiment of the invention provides a network-optimized drilling accident prediction device 900, which may include:

[0280] The first module, 901, is used to acquire drilling data and organize it into test and validation sets. The drilling data includes drilling characteristic data and drilling accident types.

[0281] The second module 902 is used to use a preset neural network as the first neural network; the network topology of the preset neural network is preset based on the number of features in the drilling feature data.

[0282] The third module 903 is used to initialize the population tribes; the population tribes are used as the first tribe; the first tribe includes a first number of populations, each population includes a second number of individuals, each individual includes network parameters corresponding to the network topology of the first neural network, the second number represents random numbers within a preset interval; each population in the first tribe is set with an evolution probability, the evolution probability includes at least one of crossover probability and mutation probability;

[0283] The fourth module 904 is used to traverse all individuals of each population in the first tribe, and then obtain the first prediction accuracy corresponding to the network parameters of each individual in the first neural network through test set processing; obtain the largest first prediction accuracy in the first tribe as the target accuracy; when the target accuracy is greater than the first threshold, the individual corresponding to the target accuracy is taken as the target individual; otherwise, the first evolutionary processing is performed on the corresponding population based on the evolutionary probability of each population to obtain the second tribe.

[0284] The fifth module 905 is used to traverse all individuals in each population of the second tribe, and then obtain the second prediction accuracy corresponding to the network parameters of each individual in the first neural network through test set processing; based on the second prediction accuracy and combined with the preset tribe selection operator, select individuals from each population of the second tribe, and perform the second evolutionary processing between populations in the second tribe according to the selected individuals to obtain the third tribe.

[0285] Module 6, 906, is used to increment the iteration count by 1. When the iteration count reaches the iteration threshold, the target individual is determined based on the third tribe obtained from the last iteration. Otherwise, the third tribe is used as the first tribe, and the process of traversing all individuals in each population of the first tribe is returned. The initial iteration count is 0.

[0286] The seventh module 907 is used to obtain the fourth prediction accuracy corresponding to the network parameters of the target individual applied to the first neural network through validation set processing. When the fourth prediction accuracy is greater than the second threshold, the network parameters of the target individual are applied to the first neural network as the target neural network; otherwise, the network topology of the first neural network is adjusted to obtain the second neural network, the iteration count is reset to 0, the second neural network is used as the first neural network, and then the process returns to execute the initialization of the population tribe.

[0287] The eighth module 908 is used to predict drilling accidents based on the drilling data to be predicted through the target neural network, and obtain the drilling prediction results.

[0288] In some embodiments, the preset neural network includes an input layer, a hidden layer, and an output layer; the apparatus may further include:

[0289] The ninth module is used to set the first number of neurons in the input layer of the preset neural network based on the number of features in the drilling feature data.

[0290] The tenth module is used to set the second number of neurons in the hidden layer of the preset neural network based on the first number and in combination with the preset quantitative relationship; wherein, the third number of neurons in the output layer is 1; the network parameters include weight parameters and threshold parameters;

[0291] The eleventh module is used to determine the fourth quantity of weight parameters based on the sum of the product of the first quantity and the second quantity and the product of the second quantity and the third quantity; and to determine the quantity of threshold parameters based on the sum of the second quantity and the third quantity.

[0292] The content of the method embodiments of the present invention is applicable to the device embodiments. The specific functions implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.

[0293] On the other hand, embodiments of the present invention also provide an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method for predicting the bottom boundary of the hydrate stability domain. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0294] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0295] like Figure 10 As shown, Figure 10 The hardware structure of an electronic device 1000 according to another embodiment is illustrated. The electronic device 1000 includes:

[0296] The processor 1001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention.

[0297] The memory 1002 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 1002 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001 to execute the network node population optimization method of the embodiments of this invention.

[0298] Input / output interface 1003 is used to implement information input and output;

[0299] The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0300] Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004);

[0301] The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.

[0302] The electronic device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0303] The content of the method embodiments of the present invention is applicable to the embodiments of the present electronic device. The specific functions implemented by the embodiments of the present electronic device are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.

[0304] Another aspect of this invention provides a computer-readable storage medium storing a program that is executed by a processor to implement the aforementioned method.

[0305] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can 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 of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD to ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, wherein computer-readable program code is carried. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0306] The content of the method embodiments of the present invention is applicable to the computer-readable storage medium embodiments. The specific functions implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.

[0307] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned method.

[0308] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0309] It should be noted that although several modules for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0310] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, portable hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of the present invention.

[0311] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented in this invention. Alternative embodiments are contemplated, in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.

[0312] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.

[0313] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0314] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution means, apparatus, or device (such as a computer-based device, a processor-including device, or other means that can fetch and execute instructions from, or in conjunction with, an instruction execution means, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution means, apparatus, or device.

[0315] More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0316] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution device. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0317] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0318] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

[0319] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.

Claims

1. A network optimization based drilling incident prediction method, characterized by, The method comprises the following steps: obtaining drilling data, and arranging a test set and a verification set based on the drilling data; the drilling data comprises drilling feature data and drilling accident types; wherein the drilling feature data comprises lithology, aperture, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, bit rotation speed, original fracture direction, cement slurry density, drilling fluid density, inlet flow, outlet flow, pump displacement; a preset neural network is used as a first neural network; a network topology structure of the preset neural network is preset based on a feature quantity of the drilling feature data; a population colony is initialized; the population colony is used as a first colony; the first colony comprises a first quantity of populations, each of the populations comprises a second quantity of individuals, the individuals comprise network parameters corresponding to the network topology structure of the first neural network, and the second quantity represents a random number in a preset interval; each population of the first colony is provided with an evolution probability, and the evolution probability comprises at least one of a crossover probability and a mutation probability; all the individuals of each population in the first colony are traversed, and then a first prediction accuracy corresponding to the network parameters of each individual is obtained by processing the test set by using the first neural network; a maximum first prediction accuracy in the first colony is obtained as a target accuracy; when the target accuracy is greater than a first threshold, an individual corresponding to the target accuracy is used as a target individual; otherwise, a corresponding population is subjected to first evolution processing based on the evolution probability of each population, and a second colony is obtained; all the individuals of each population in the second colony are traversed, and then a second prediction accuracy corresponding to the network parameters of each individual is obtained by processing the test set by using the first neural network; selected individuals are obtained from each population in the second colony based on the second prediction accuracy and a preset colony selection operator; the second colony is subjected to second evolution processing between the populations according to the selected individuals, and a third colony is obtained; an iteration number is increased by 1; when the iteration number reaches an iteration threshold, a target individual is determined according to the third colony obtained in the last iteration; otherwise, the third colony is used as the first colony, and then the step of traversing all the individuals of each population in the first colony is executed again; wherein the iteration number is initially 0; a fourth prediction accuracy corresponding to the network parameters of the target individual is obtained by processing the verification set by using the first neural network; when the fourth prediction accuracy is greater than a second threshold, the network parameters of the target individual are applied to the first neural network as a target neural network; otherwise, the network topology structure of the first neural network is adjusted to obtain a second neural network, the iteration number is reset to 0, the second neural network is used as the first neural network, and then the step of initializing the population colony is executed again; a drilling accident is predicted according to to-be-predicted drilling data by using the target neural network, and a drilling prediction result is obtained.

2. The network optimization based drilling incident prediction method of claim 1, wherein, The preset neural network comprises an input layer, a hidden layer and an output layer; the method further comprises the following steps: The first number of neurons of the input layer of the preset neural network is set according to the number of features of the drilling feature data; The second number of neurons of the hidden layer of the preset neural network is set based on the first number and in combination with a preset number relationship; the third number of neurons of the output layer is 1; the network parameters comprise weight parameters and threshold parameters; The fourth number of the weight parameters is determined according to the sum of the product of the first number and the second number and the product of the second number and the third number; the number of the threshold parameters is determined according to the sum of the second number and the third number.

3. The network optimization based drilling incident prediction method of claim 1, wherein, The first prediction accuracy corresponding to the network parameters of each individual is obtained by processing the test set through the first neural network, the maximum first prediction accuracy in the first tribe is obtained as a target accuracy, when the target accuracy is greater than a first threshold, the individual corresponding to the target accuracy is taken as a target individual, otherwise, the first evolution processing is performed on each population based on the evolution probability of the corresponding population, and a second tribe is obtained, comprising the following steps: The first population in the first tribe is taken as a target population; The first individual in the target population is taken as a preliminary individual; The network parameters of the preliminary individual are applied to the first neural network as a preliminary neural network; The preliminary result is obtained by performing prediction processing on all the drilling feature data in the test set by using the preliminary neural network; all the preliminary results are compared with the drilling accident types corresponding to the pairing of the drilling feature data, and the first prediction accuracy corresponding to the network parameters of the preliminary individual is obtained according to the proportion of the same results; The next individual of the preliminary individual in the target population is taken as the preliminary individual, and the step of applying the network parameters of the preliminary individual to the first neural network as a preliminary neural network is executed until the first prediction accuracy of all the individuals of the target population is obtained; The maximum first prediction accuracy in the target population is obtained as the target accuracy, when the target accuracy is greater than the first threshold, the individual corresponding to the target accuracy is taken as a target individual, otherwise, the first evolution processing is performed on the target population based on the evolution probability preset for the target population; the first evolution processing comprises at least one of a crossover operation and a mutation operation; The next population of the target population in the first tribe is taken as the target population, and the step of taking the first individual in the target population as a preliminary individual is executed until the target individual or the second tribe is obtained.

4. The network optimization based drilling incident prediction method of claim 1, wherein, The selected individual is obtained from each population in the second tribe based on the second prediction accuracy and in combination with a preset tribe selection operator, comprising the following steps: obtaining a standard deviation of the accuracy rate of each of the populations in the second tribe based on the second prediction accuracy rate processing; obtaining a target difference value of each of the populations in the second tribe by sequentially subtracting the first threshold value from the standard deviation of the accuracy rate of each of the populations in the second tribe; determining the selection quantity of the selected individuals of each of the populations in the second tribe according to the product of the target difference value of each of the populations in the second tribe and the second quantity of the corresponding population; obtaining a corresponding quantity of the individuals from the corresponding population as the selected individuals based on the selection quantity; wherein the selected individuals are a batch of the individuals with the maximum second prediction accuracy rate in each of the populations.

5. The network optimization based drilling incident prediction method of claim 1, wherein, the second evolution processing between the populations of the second tribe according to the selected individuals, comprising the following steps: obtaining a selection total number of all the populations in the second tribe by obtaining the selection quantity of the selected individuals of each of the populations in the second tribe; obtaining a sum of accuracy rates by adding the maximum second prediction accuracy rate of each of the populations in the second tribe; determining a corresponding admission ratio of each of the populations based on the ratio of the maximum second prediction accuracy rate of each of the populations in the second tribe to the sum of accuracy rates; determining a corresponding admission quantity of each of the populations according to the product of the admission ratio of each of the populations in the second tribe and the selection total number; sorting all the selected individuals in the second tribe in a descending order of the second prediction accuracy rate to obtain a selection sequence; taking the selected individuals of the admission quantity from the front sequence of the selection sequence as admission individuals according to the order of the admission quantity from large to small and putting the admission individuals into the corresponding population of the second tribe.

6. The network optimization based drilling incident prediction method of claim 5, wherein, the second evolution processing between the populations of the second tribe according to the selected individuals, further comprising the following steps: taking a first population in the second tribe as a target population; obtaining a crossover quantity of the target population by combining a preset operation rule based on the selection quantity and the admission quantity of the target population; randomly obtaining a first individual from all the admission individuals put into the target population and a second individual from all the admission individuals put into the populations other than the target population in the second tribe; performing gene crossover processing on the first individual and the second individual to obtain a crossover individual; putting the crossover individual into the target population and adding 1 to a crossover number; the crossover number is initialized as 0; returning to the step of randomly obtaining a first individual from all the admission individuals put into the target population until the crossover number is equal to the crossover quantity, resetting the crossover number as 0, and taking a next population of the target population in the second tribe as the target population; Return to execute the step of processing the selected number and the admitted number of the target population based on the target population in combination with a preset operation rule to obtain the cross number of the target population until all the populations in the second tribe are put into the corresponding cross number of the cross individual.

7. The network optimization based drilling incident prediction method of claim 1, wherein, The step of determining the target individual according to the third tribe obtained by the last iteration comprises the following steps: Traverse all the individuals of each population in the third tribe, and then obtain a third prediction accuracy corresponding to the network parameters of each individual applied by the first neural network through the test set processing. The individual corresponding to the maximum third prediction accuracy in the third tribe is taken as the target individual.

8. A network optimization based drilling incident prediction apparatus, characterized by, Comprise: A first module is configured to obtain drilling data, and arrange a test set and a verification set based on the drilling data; the drilling data comprises drilling feature data and drilling accident type; wherein the drilling feature data comprises lithology, aperture, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, drill bit speed, original fracture direction, cement slurry density, drilling fluid density, inlet flow, outlet flow, pump displacement; A second module is configured to take a preset neural network as a first neural network; the network topology structure of the preset neural network is preset based on the feature number of the drilling feature data; A third module is configured to initialize a population tribe; the population tribe is taken as a first tribe; the first tribe comprises a first number of populations, each population comprises a second number of individuals, the individuals comprise network parameters corresponding to the network topology structure of the first neural network, and the second number represents a random number in a preset interval; each population of the first tribe is provided with an evolution probability, and the evolution probability comprises at least one of a crossover probability and a mutation probability; A fourth module is configured to traverse all the individuals of each population in the first tribe, and then obtain a first prediction accuracy corresponding to the network parameters of each individual applied by the first neural network through the test set processing; obtain the maximum first prediction accuracy in the first tribe as a target accuracy; when the target accuracy is greater than a first threshold, take the individual corresponding to the target accuracy as a target individual; otherwise, perform first evolution processing on the corresponding population based on the evolution probability of each population to obtain a second tribe; A fifth module is configured to traverse all the individuals of each population in the second tribe, and then obtain a second prediction accuracy corresponding to the network parameters of each individual applied by the first neural network through the test set processing; obtain selected individuals from each population in the second tribe based on the second prediction accuracy in combination with a preset tribe selection operator; perform second evolution processing between the populations of the second tribe according to the selected individuals to obtain a third tribe. a sixth module configured to add 1 to the iteration number; when the iteration number reaches an iteration threshold, determine the target individual according to the third tribe obtained in the last iteration; otherwise, take the third tribe as the first tribe, and then return to execute the step of traversing all the individuals in each population in the first tribe; wherein the iteration number is initially 0; a seventh module configured to obtain a fourth prediction accuracy corresponding to the network parameters of the target individual applied to the first neural network by processing the validation set, when the fourth prediction accuracy is greater than a second threshold, apply the network parameters of the target individual to the first neural network as a target neural network; otherwise, adjust the network topology of the first neural network to obtain a second neural network, reset the iteration number to 0, take the second neural network as the first neural network, and then return to execute the step of initializing the population tribe; an eighth module configured to perform drilling accident prediction according to the drilling data to be predicted by the target neural network to obtain a drilling prediction result.

9. An electronic device, comprising: comprise a processor and a memory; the memory is configured to store a program; the processor executes the program to implement the method of any one of claims 1 to 7.

10. A computer storage medium having stored thereon a program that is executable by a processor, the program comprising instructions for causing the processor to perform the method of any one of claims 1-9. The program executable by the processor, when executed by the processor, is configured to implement the method of any one of claims 1 to 7. The program executable by the processor, when executed by the processor, is configured to implement the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method for predicting working fluid level of submersible reciprocating pumping unit through improved neural network

    CN118153651A

  • Low-altitude communication network organization method based on artificial intelligence

    CN118659978A