Neural network-based stream tube approximation generation method, apparatus, medium, and device
By constructing and training a simulation deep neural network based on a time-segmentation method using neural networks, a high-precision flow tube approximation is generated, which solves the problem of maintaining the accuracy of the flow tube over-approximation in continuous systems and achieves high accuracy and stability over system time.
Patent Information
- Application Number
- CN202410919136.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2044-07-08
AI Technical Summary
How to generate a high-precision flow tube over-approximation in a continuous system, and maintain the accuracy as much as possible as the system time increases.
A neural network-based approach is adopted, which constructs a simulated deep neural network in time-segmented manner, trains it using positive and negative sample sets, and optimizes the neural network parameters by combining a hybrid integer programming constraint solver to generate a high-precision flow tube approximation.
Compared to traditional methods, it maintains higher accuracy over the entire system time limit and exhibits less accuracy degradation in a short period compared to the Taylor model, effectively controlling the accuracy of the flow tube approximation.
Smart Images

Figure CN118734708B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the simulation approximation and safety verification technology of continuous systems. BACKGROUND
[0002] Continuous system flow tube over-approximation generation is to generate a set for a given continuous system, which is within the specified time line, and the system variable reachable state set is included. This set contains all possible states of the system within the specified time, which is very important for verifying the properties of the continuous system, such as judging whether the system can reach some specific non-safe state, so as to ensure the safety of the continuous system. Obviously, a full set containing all states can be a flow tube over-approximation, but it is of no help for verification, and even can produce false results. Therefore, how to generate a high-precision flow tube over-approximation is a key problem. SUMMARY
[0003] The problem to be solved by the present application is: in a continuous system, how to generate a flow tube over-approximation with higher precision and try not to let the precision deteriorate with the increase of system time.
[0004] To solve the above problems, the scheme adopted by the present application is as follows:
[0005] The flow tube approximation generation method based on neural network according to the present application comprises the following steps:
[0006] Step S1: obtaining the information of the continuous system to be processed; the information of the continuous system at least includes system variables, differential equations of system variables with respect to time, initial value range of system variables, and running time length of the continuous system;
[0007] Step S2: dividing the running time of the continuous system into N time periods in an equal time length manner according to the running time length, and constructing a simulation deep neural network of the continuous system for each of the N time periods;
[0008] Step S3: simulating the running of the continuous system through sampling of system variables within and outside the initial value range, and constructing a positive example sample set and a negative example sample set for each of the N time periods; the positive example sample set and the negative example sample set are both sample sets; the samples are sampling values of system variables; in the positive example sample set, the sampling values of system variables are obtained based on the simulation running of the continuous system after sampling of system variables within the initial value range; in the negative example sample set, the sampling values of system variables are obtained based on the simulation running of the continuous system after sampling of system variables outside the initial value range;
[0009] Step S4: inputting the samples in the positive example sample set and the negative example sample set of the N time periods into the simulation deep neural network of each of the N time periods as training sample inputs of the simulation deep neural network, and training the simulation deep neural network;
[0010] Step S5: extract the model parameter data of the N trained simulation deep neural networks, and construct the mixed integer constraint code describing the maximum output problem of the simulation deep neural network corresponding to the N time periods according to the extracted model parameter data, and then solve the constraint of the maximum output problem of the simulation deep neural network through the mixed integer programming constraint solver to obtain the corresponding extreme value and extreme point; if the extreme value is greater than zero, the corresponding extreme point is added to the corresponding counterexample sample set, and the simulation deep neural network is further trained until the corresponding extreme value is less than or equal to zero;
[0011] The simulation deep neural network comprises an input layer, n hidden layers and an output layer, and is represented as:
[0012] A out =w out z n +b out ;
[0013] z k =δ(w k z k-1 +b k ),k=1,2,…,n;
[0014] z0=x;
[0015] Wherein, A out is the output of the simulation deep neural network;
[0016] w out and b out are the output layer parameters of the simulation deep neural network, w out is a vector, and b out is a numerical value;
[0017] w k and b k are the kth hidden layer parameters of the simulation deep neural network, both of which are vectors, wherein k=1,2,…,n;
[0018] z k is the kth hidden layer output vector of the simulation deep neural network, wherein k=1,2,…,n;
[0019] z0 is the input layer output vector of the simulation deep neural network;
[0020] x is a vector composed of system variables;
[0021] n represents the number of hidden layers included in the simulation deep neural network;
[0022] δ is an activation function.
[0023] Further, according to the flow pipe approximation generation method of the present application, in the step S3, the positive example sample set of N time periods is constructed by the following steps:
[0024] Step S3A1: obtaining an initial vector composed of initial values of system quantities by sampling in an initial value domain
[0025] Step S3A2: calculating the instantaneous values within the value domain of system quantities at each time point within the continuous system running duration according to the formula Then, the instantaneous values within the value domain of system quantities at each time point are added as samples to the positive example sample set of the corresponding time period.
[0026] The negative example sample set of N time periods is constructed by the following steps:
[0027] Step S3B1: obtaining an initial vector composed of initial values of system quantities by sampling outside the initial value domain
[0028] Step S3B2: calculating the instantaneous values outside the value domain of system quantities at each time point within the continuous system running duration according to the formula Then, the instantaneous values within the value domain of system quantities at each time point are added as samples to the negative example sample set of the corresponding time period.
[0029] Wherein,
[0030] The time points corresponding to the jth time period are (j*M-M)*dT, (j*M-M+1)*dT, (j*M-M+2)*dT, …, (j*M)*dT, j=1, 2, 3, …, N;
[0031] And Respectively represent the instantaneous values within the value domain and outside the value domain of system quantities at the time point i*dT;
[0032] Wherein, i=1, 2, 3, …, N*M, T is the running duration of the continuous system;
[0033] F is the differential equation of the system quantity with respect to time;
[0034] M is the number of fine divisions of time points within the time period.
[0035] Further, according to the flow pipe approximation generation method of the present application, in the step S4, training the simulation deep neural network with the samples in the positive example sample set and the negative example sample set includes the following steps:
[0036] Step S41: inputting the samples in the positive example sample set and the negative example sample set into the simulation deep neural network one by one to obtain the output corresponding to each sample;
[0037] Step S42: calculating the positive example loss function value and the negative example loss function value;
[0038] Step S43: taking the sum of the positive example loss function value and the negative example loss function value as the loss function value of the optimizer to optimize the parameters of the simulation deep neural network;
[0039] Step S44: repeating steps S41 to S44 until the sum of the positive example loss function value and the negative example loss function value is 0;
[0040] The positive example loss function value and the negative example loss function value are calculated by the following formula:
[0041]
[0042] Wherein,
[0043] represents the positive example loss function value of the tth training,
[0044] represents the negative example loss function value of the tth training,
[0045] represents the output obtained by inputting the kth sample in the positive example sample set into the simulation deep neural network;
[0046] represents the output obtained by inputting the kth sample in the negative example sample set into the simulation deep neural network;
[0047] NP represents the number of samples in the positive example sample set;
[0048] NN represents the number of samples in the negative example sample set;
[0049] max and min represent taking the maximum value and the minimum value, respectively.
[0050] Further, according to the flow pipe approximation generation method of the present application, when the steps S3A1 and S3B1 generate the initial vector and the initial value range boundary is refined around.
[0051] According to the neural network-based flow pipe approximation generation device of the present application, the device comprises the following modules:
[0052] The module M1 is configured to acquire information of a continuous system to be processed, and the information of the continuous system at least includes system variables, differential equations of the system variables with respect to time, initial value ranges of the system variables, and a running time length of the continuous system.
[0053] The module M2 is configured to divide the running time of the continuous system into N time periods in an equal time length manner according to the running time length, and construct simulation deep neural networks of the continuous system for the N time periods respectively.
[0054] The module M3 is configured to simulate the running of the continuous system through sampling of the system variables within and outside the initial value ranges, and construct positive sample sets and negative sample sets for the N time periods respectively; the positive sample sets and the negative sample sets are both sample sets; the samples are sampling values of the system variables; in the positive sample sets, the sampling values of the system variables are obtained based on the simulation running of the continuous system after sampling of the system variables within the initial value ranges; in the negative sample sets, the sampling values of the system variables are obtained based on the simulation running of the continuous system after sampling of the system variables outside the initial value ranges.
[0055] The module M4 is configured to input the samples in the positive sample sets and the negative sample sets of the N time periods into the simulation deep neural networks of the N time periods respectively as training sample inputs to train the corresponding simulation deep neural networks.
[0056] The module M5 is configured to extract model parameter data of the N trained simulation deep neural networks, and construct mixed integer constraint encodings corresponding to the N time periods and describing maximum output problems of the simulation deep neural networks according to the extracted model parameter data, and then perform constraint solving of the mixed integer constraint encodings by a mixed integer programming constraint solver to obtain corresponding extreme values and extreme points; if the extreme value is greater than zero, the corresponding extreme point is added to the corresponding negative sample set, and the simulation deep neural network is further trained until the corresponding extreme value is less than or equal to zero.
[0057] The simulation deep neural network includes an input layer, n hidden layers, and an output layer, and is expressed as:
[0058] A out =w out z n +b out ;
[0059] z k =δ(w k z k-1 +b k ),k=1,2,…,n;
[0060] z0=x;
[0061] Among them, A out To simulate the output of a deep neural network, a value greater than 0 is represented as:
[0062] w out and b out To simulate the output layer parameters of a deep neural network, w out Let b be a vector. out Numerical value;
[0063] w k and b k The parameters of the k-th hidden layer in the simulation deep neural network are all vectors, where k = 1, 2, ..., n;
[0064] z k This is the output vector of the k-th hidden layer in a deep neural network, where k = 1, 2, ..., n;
[0065] z0 is the output vector of the input layer of the simulated deep neural network;
[0066] x is a vector composed of system quantities;
[0067] n represents the number of hidden layers in the simulated deep neural network;
[0068] δ is the activation function.
[0069] Furthermore, according to the flow tube approximation generation device of the present invention, in module M3, the set of positive sample data for N time periods is constructed through the following modules:
[0070] Module M3A1 is used to: obtain an initial vector composed of the initial values of the system quantities by sampling within the initial value domain.
[0071] Module M3A2 is used for: according to the formula Calculate the instantaneous values of the system quantities at each time point within the runtime of a continuous system. Then, the instantaneous values within the system quantity domain at each time point are added as samples to the positive sample set for the corresponding time period;
[0072] The set of counterexample samples for N time periods is constructed using the following modules:
[0073] Module M3B1 is used to: obtain an initial vector composed of the initial values of the system quantities by sampling outside the initial value domain.
[0074] Module M3B2 is used for: according to the formula Calculate the instantaneous values of system quantities outside the domain at each time point within the runtime of a continuous system. Then, the instantaneous values in the system magnitude range at each time point are added to the counterexample sample set of the corresponding time period as samples;
[0075] wherein,
[0076] The time points corresponding to the jth time period are (j*M-M)*dT, (j*M-M+1)*dT, (j*M-M+2)*dT, …, (j*M)*dT, j = 1, 2, 3, …, N, respectively;
[0077] and represent the instantaneous value in the system magnitude range and the instantaneous value outside the range at the time point i*dT, respectively;
[0078] wherein, i = 1, 2, 3, …, N*M, T is the running time length of the continuous system;
[0079] F is the differential equation of the system quantity with respect to time;
[0080] M is the number of fine divisions of the time points in the time period.
[0081] Further, according to the flow pipe approximation generation device of the present application, the training of the simulation deep neural network with the samples in the positive example sample set and the counterexample sample set in the module M4 comprises the following modules:
[0082] Module M41, for: inputting the samples in the positive example sample set and the counterexample sample set to the simulation deep neural network one by one to obtain the output corresponding to each sample;
[0083] Module M42, for: calculating the positive loss function value and the counterexample loss function value;
[0084] Module M43, for: optimizing the parameters of the simulation deep neural network with the sum of the positive loss function value and the counterexample loss function value as the loss function value of the optimizer;
[0085] Module M44, for: repeating the functions of the modules M41 to M44 until the sum of the positive loss function value and the counterexample loss function value is 0;
[0086] The positive loss function value and the counterexample loss function value are calculated by the following formula:
[0087]
[0088] wherein,
[0089] represents the positive loss function value of the tth round of training,
[0090] represents the counterexample loss function value of the t-th round of training,
[0091] represents the output obtained by inputting the k-th sample in the positive example sample set into the simulated deep neural network;
[0092] represents the output obtained by inputting the k-th sample in the counterexample sample set into the simulated deep neural network;
[0093] NP is the number of samples in the positive example sample set;
[0094] NN is the number of samples in the counterexample sample set;
[0095] max and min represent taking the maximum and minimum values, respectively.
[0096] Further, according to the flow pipe approximation generation device of the present application, the modules M3A1 and M3B1 generate initial vectors and when the initial value range boundary is finely divided.
[0097] According to a medium of the present application, the medium stores a set of program instructions readable by a machine, and when the set of program instructions stored in the medium is read and executed by the machine, the machine can implement the flow pipe approximation generation method described above.
[0098] According to a device of the present application, the device comprises a connected processor and a memory; the memory stores a set of program instructions; when the set of program instructions stored in the memory is read and executed by the processor, the device can implement the flow pipe approximation generation method described above.
[0099] The technical effects of the present application are as follows:
[0100] 1. Compared with the traditional polyhedral approximation method, the accuracy is higher within the entire system time limit.
[0101] 2. Compared with the traditional Taylor model approximation method, the accuracy is similar in a short time, but the decline in accuracy of the flow pipe approximation is much smaller than that of the Taylor model.
[0102] 3. The present application can generate a flow pipe approximation for any two-dimensional continuous system as much as possible, and by adjusting the interval between data sets, the accuracy of the flow pipe approximation can be effectively controlled. BRIEF DESCRIPTION OF DRAWINGS
[0103] Figure 1 is a flow diagram of the continuous flow system flow pipe approximation generation method of the embodiment of the present application.
[0104] Figure 2 is a structural schematic diagram of an electronic device of an embodiment of the present application. DETAILED DESCRIPTION
[0105] The present application will be further described in detail below with reference to the accompanying drawings.
[0106] Figure 2 An electronic device is exemplified, which is a general-purpose computer device of the von Neumann architecture, and at least includes a processor 201 and a memory 202 connected to each other. The memory 201 is used to store a computer program instruction set and data. The memory 201 is the machine readable medium referred to in the present application, and is usually a persistent storage device, including but not limited to, for example, a magnetic disk, a magnetic tape, a solid state disk, etc. The processor 202 realizes its corresponding functions by loading and executing the computer program instruction set stored in the memory 201. In the present embodiment, the electronic device realizes the flow pipe approximation generation method referred to in the present application by executing the computer program instruction set stored in the memory 201 through the processor 202.
[0107] Reference Figure 1 , the flow pipe approximation generation method of the present application includes a time-division neural network construction step, a training sample simulation generation step, a time-division neural network training step, and a constraint coding and constraint solving step. The aforementioned step S1 acquires the information of the continuous system to be processed, which represents the input of the present application as the information of the continuous system. The output of the present application is a deep neural network that is the flow pipe approximation of the inputted continuous system. The information of the continuous system includes system quantities, differential equations of the system quantities with respect to time, initial value ranges of the system quantities, and a running time length of the continuous system. Among them, the system quantities of the continuous system are usually multiple, and the multiple system quantities constitute a system quantity set. The deep neural network outputted by the present application is a series of time-division deep neural networks, each of which represents the flow pipe approximation of the continuous system in a certain time period.
[0108] For example, in a certain continuous system, the system quantities are a and b, the differential equations of the system quantities with respect to time are ta=b and tb=0.2*(1-a*a)*b-a; the initial value range is {0.8≤a≤1, 0.4≤b≤0.6}, and the running time length is 10s. Among them, ta represents the differential of the system quantity a with respect to time, and tb represents the differential of the system quantity b with respect to time.
[0109] The time period division neural network construction step, i.e., the aforementioned step S2, divides the running time of the continuous system into N time periods in an equal time period manner according to the running time length, and constructs a simulation deep neural network of the continuous system for each of the N time periods. For example, the continuous system in the aforementioned example has a running time length of 10s, and can be divided into 20 time periods according to a time period length of 0.5s. Then, 20 simulation deep neural networks are constructed, each of which corresponds to a time period. In this embodiment, N is determined according to the time length of each time period and the running time length of the continuous system. Specifically, N = T / ST, where T is the running time length of the continuous system, and ST is the time length of each time period set in advance, which is usually set to 0.5s, 1s, 2s, etc. The simulation deep neural network is composed of an input layer, a plurality of hidden layers, and an output layer, and can be specifically represented as:
[0110] A out =w out z n +b out ;
[0111] z k =δ(w k z k-1 +b k ),k=1,2,…,n;
[0112] z0=x;
[0113] wherein A out is the output of the simulation deep neural network;
[0114] w out and b out are the output layer parameters of the simulation deep neural network, w out is a vector, and b out is a numerical value;
[0115] w k and b k are the kth hidden layer parameters of the simulation deep neural network, both of which are vectors, wherein k = 1, 2, …, n;
[0116] z k is the kth hidden layer output vector of the simulation deep neural network, wherein k = 1, 2, …, n;
[0117] n represents the number of hidden layers included in the simulation deep neural network;
[0118] z0is the input layer output vector of the simulation deep neural network;
[0119] x is a vector composed of system quantities;
[0120] δ is an activation function.
[0121] The activation function δ usually adopts a ReLU activation function.
[0122] In the initially constructed deep neural network, the hidden layer parameters w k and b k and the output layer parameters w out and b out are usually determined randomly.
[0123] The training sample simulation generation step, that is, the aforementioned step S3, simulates the operation of the continuous system by sampling the system quantity within and outside the initial value range, and constructs a positive example sample set and a negative example sample set for N time periods respectively. The N time periods correspond to N simulation deep neural networks, that is, each simulation deep neural network corresponds to a positive example sample set and a negative example sample set. Both the positive example sample set and the negative example sample set are sample sets. The sample is the sampling value of the system quantity. In the positive example sample set, the sampling value of the system quantity is obtained based on the simulation operation of the continuous system after sampling the system quantity within the initial value range. In the negative example sample set, the sampling value of the system quantity is obtained based on the simulation operation of the continuous system after sampling the system quantity outside the initial value range. Specifically, in this step, the positive example sample sets of the N time periods are constructed by the following steps:
[0124] Step S3A1: An initial vector
[0125] Step S3A2: According to the formula , the instantaneous value of the system quantity within the value range at each time point within the running duration of the continuous system is calculated Then, the instantaneous value of the system quantity within the value range at each time point is added to the positive example sample set of the corresponding time period as a sample.
[0126] The negative example sample sets of the N time periods are constructed by the following steps:
[0127] Step S3B1: An initial vector
[0128] Step S3B2: According to the formula , the instantaneous value of the system quantity outside the value range at each time point within the running duration of the continuous system is calculated Then, the instantaneous value of the system quantity within the value range at each time point is added to the negative example sample set of the corresponding time period as a sample.
[0129] In the above steps, and respectively represent the in-range and out-of-range instantaneous values of the system quantity at the time point i*dT, i=1, 2, 3, …, N*M, T is the running time of the continuous system; F is the differential equation of the system quantity with respect to time; and M is the number of fine divisions of the time points in the time period. Both are vectors composed of the values of the system quantity. The time points corresponding to the jth time period are (j*M-M)*dT, (j*M-M+1)*dT, (j*M-M+2)*dT, …, (j*M)*dT, j=1, 2, 3, …, N, that is, the positive example sample set and the negative example sample set in each time period include M+1 values of the system quantity at the time points. In steps S3A1 and S3B1, the vectors and the vector There are multiple, multiple vectors and the vector compose the vector set and the vector set, and correspondingly, the vector and also compose the set. Therefore, the number of samples in the positive example sample set and the negative example sample set is (M+1)*K + and (M+1)*K - , where K + is the number of initial vectors generated in step S3A1, and K - is the number of initial vectors generated in step S3B1.
[0130] The number of fine divisions of the time points in the time period M is usually determined by the length of the fine division of the time points, that is, M=ST / MT. Where ST is the length of the time period, and MT is the length of the fine division. For example, ST=0.5s, MT=25ms, then M=20.
[0131] In steps S3A1 and S3B1, when generating the initial vectors and , random sampling method can be used, or grid point sampling method can be used. In this embodiment, grid point sampling method is preferred, for example, in the continuous system of the foregoing example, the initial value range of the system quantities a and b is defined as {0.8≤a≤1, 0.4≤b≤0.6}. The grid lines of the system quantity a are 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, and the grid lines of the system quantity b are 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8. After the grid lines of the system quantities a and b are combined two by two, the following in-range initial vectors
[0132] {0.8, 0.4}, {0.8, 0.5}, {0.8, 0.6}, {0.9, 0.4}, {0.9, 0.5}, {0.9, 0.6}, {1.0, 0.4}, {1.0, 0.5}, {1.0, 0.6};
[0133] Out-of-domain initial vectors
[0134] {0.6, 0.2}, {0.6, 0.3}, {0.6, 0.4}, {0.6, 0.5}, {0.6, 0.6}, {0.6, 0.7}, {0.6, 0.8},
[0135] {0.7, 0.2}, {0.7, 0.3}, {0.7, 0.4}, {0.7, 0.5}, {0.7, 0.6}, {0.7, 0.7}, {0.7, 0.8},
[0136] {1.1, 0.2}, {1.1, 0.3}, {1.1, 0.4}, {1.1, 0.5}, {1.1, 0.6}, {1.1, 0.7}, {1.1, 0.8},
[0137] {1.2, 0.2}, {1.2, 0.3}, {1.2, 0.4}, {1.2, 0.5}, {1.2, 0.6}, {1.2, 0.7}, {1.2, 0.8},
[0138] {0.8, 0.2}, {0.9, 0.2}, {1.0, 0.2}, {0.8, 0.3}, {0.9, 0.3}, {1.0, 0.3},
[0139] {0.8, 0.7}, {0.9, 0.7}, {1.0, 0.7}, {0.8, 0.3}, {0.9, 0.3}, {1.0, 0.3}.
[0140] Further, to enable the deep neural network to more accurately approximate the continuous system, steps S3A1 and S3B1 generate initial vectors and When the initial value range boundary is approached, the grid points are refined. In the grid point refinement mode, the grid points are more densely distributed when they are closer to the initial value range boundary. For example, in the continuous system of the foregoing example, the grid lines of system quantity a are divided into: 0.6, 0.7, 0.76, 0.79, 0.8, 0.81, 0.83, 0.9, 0.97, 0.99, 1.0, 1.01, 1.04, 1.1, 1.2; and the grid lines of system quantity b are divided into: 0.2, 0.3, 0.36, 0.39, 0.4, 0.41, 0.43, 0.5, 0.57, 0.59, 0.6, 0.61, 0.64, 0.7, 0.8. The grid points formed by the combination of the grid lines of system quantities a and b are more densely distributed and more refined when they are closer to the initial value range boundary.
[0141] The time period division neural network training step, i.e., the step S4, uses the samples in the positive example sample set and the negative example sample set of the N time periods as the training sample inputs of the simulation deep neural network of the N time periods, and trains the simulation deep neural network.
[0142] The step S41 inputs the samples in the positive example sample set and the negative example sample set into the simulation deep neural network one by one to obtain the outputs corresponding to the samples.
[0143] The step S42 calculates the positive loss function value and the negative loss function value.
[0144] The step S43 optimizes the parameters of the simulation deep neural network using the sum of the positive loss function value and the negative loss function value as the loss function value of the optimizer.
[0145] The steps S41 to S44 are repeated until the sum of the positive loss function value and the negative loss function value is 0.
[0146] The positive loss function value and the negative loss function value are calculated using the following formula:
[0147]
[0148] wherein,
[0149] the positive loss function value of the t-th training round,
[0150] the negative loss function value of the t-th training round,
[0151] y k represents the output of the kth sample in the positive sample set input into the simulated deep neural network;
[0152] y k represents the output of the kth sample in the negative sample set input into the simulated deep neural network;
[0153] NP represents the number of samples in the positive sample set;
[0154] NN represents the number of samples in the negative sample set;
[0155] max and min represent the maximum and minimum values, respectively.
[0156] The constraint encoding and constraint solving step, i.e., the aforementioned step S5, extracts N sets of model parameter data of the trained simulated deep neural network, and constructs a mixed integer constraint code corresponding to the maximum output problem of the simulated deep neural network for N time periods according to the extracted model parameter data. Then, a mixed integer programming constraint solver is used to solve the constraint of the maximum output problem of the simulated deep neural network for the mixed integer constraint code, to obtain the corresponding extreme value and extreme point. If the extreme value is greater than zero, the corresponding extreme point is added to the corresponding negative sample set, and the simulated deep neural network is further trained until the corresponding extreme value is less than or equal to zero.
[0157] In the above steps, the mixed integer constraint code is specifically:
[0158]
[0159] In the above mixed integer constraint code,
[0160] I represents an initial value domain; x out y represents the output of the simulated deep neural network;
[0161] j represents the simulated deep neural network corresponding to the jth time period, and j takes a value from 1 to N;
[0162] w out and b out are the output layer parameters of the simulated deep neural network;
[0163] w k and b k are the kth hidden layer parameters of the simulated deep neural network;
[0164] n represents the number of hidden layers included in the simulated deep neural network;
[0165] z k is the output vector of the kth hidden layer of the simulated deep neural network;
[0166] x0 is an input of the simulation deep neural network, which is a vector composed of system quantities;
[0167] δ is an activation function, which is a ReLU activation function;
[0168] M is the number of fine divisions of time points in a time period;
[0169] F is a differential equation of the system quantity with respect to time;
[0170] maximize represents a problem of describing the maximum output of the simulation deep neural network by the mixed integer constraint coding.
[0171] In the above steps, the extreme value is the extreme value of the output of the simulation deep neural network, that is, the extreme value of x out in the mixed integer constraint coding described above; and the extreme point is the value of the system quantity, which is a vector composed of system quantities.
[0172] It should be noted that in the above steps, the simulation deep neural network of the N time periods is trained in step S4, and the simulation deep neural network of the N time periods is encoded and solved in step S5. Those skilled in the art understand that in the preferred embodiment, the training and constraint coding solving of the simulation deep neural network can also be performed one by one, that is, the simulation deep neural network of the N time periods is traversed, the simulation deep neural network that is traversed is trained, and then the constraint coding solving is performed. If the extreme value obtained by solving is greater than zero, the corresponding extreme point is added to the corresponding counterexample sample set, and the simulation deep neural network is further trained, until the corresponding extreme value is less than or equal to zero, and the next simulation deep neural network is traversed to repeat the above training and constraint coding solving process.
[0173] In addition, the aforementioned neural network-based flow tube approximation generation device is a virtual device corresponding to the aforementioned neural network-based flow tube approximation generation method, and the modules contained therein correspond one by one to the steps in the method, and will not be described again.
Claims
1. A neural network based method for generating stream tube approximations, characterized by, The method comprises the following steps: Step S1: obtaining information of a continuous system to be processed; the information of the continuous system at least comprises system variables, differential equations of the system variables with respect to time, initial value ranges of the system variables, and a running time length of the continuous system; Step S2: dividing a running time of the continuous system into N time periods in an equal time length manner according to the running time length, and constructing simulation deep neural networks of the continuous system for the N time periods respectively; Step S3: simulating running of the continuous system through sampling of the system variables within and outside the initial value ranges, and constructing a positive sample set and a negative sample set for the N time periods respectively; the positive sample set and the negative sample set are both sample sets; the samples are sampling values of the system variables; in the positive sample set, the sampling values of the system variables are obtained based on the simulation running of the continuous system after sampling of the system variables within the initial value ranges; in the negative sample set, the sampling values of the system variables are obtained based on the simulation running of the continuous system after sampling of the system variables outside the initial value ranges; Step S4: inputting the samples in the positive sample set and the negative sample set of the N time periods into the simulation deep neural networks of the N time periods respectively as training sample inputs to train the simulation deep neural networks; Step S5: extracting model parameter data of the N trained simulation deep neural networks, and constructing hybrid integer constraint codes corresponding to the N time periods to describe maximum output problems of the simulation deep neural networks according to the extracted model parameter data, and then performing constraint solving of the hybrid integer constraint codes by a hybrid integer programming constraint solver to obtain corresponding extreme values and extreme points; If the extreme value is greater than zero, the corresponding extreme point is added to the corresponding negative sample set, and the simulation deep neural network is further trained until the corresponding extreme value is less than or equal to zero; The simulation deep neural network comprises an input layer, n hidden layers, and an output layer, and is represented as: A out = w out z n + b out ; z k = δ(w k z k-1 + b k ), k = 1, 2,..., n; z0=x; wherein A out is an output of the simulated deep neural network; w out and b out are the output layer parameters of the simulated deep neural network, w out is a vector, b out is a numerical value; w k and b k are the parameters of the kth hidden layer of the simulated deep neural network, are vectors, where k = 1, 2,..., n; z k Simulate the output vector of the kth hidden layer of the deep neural network, where k = 1, 2, …, n. z0 is an output vector of an input layer of the simulation deep neural network; x is a vector composed of system variables; n represents the number of hidden layers of the simulation deep neural network; δ is an activation function.
2. The stream tube approximation generation method of claim 1, wherein, In step S3, the positive sample set of the N time periods is constructed by the following steps: Step S3A1: obtaining an initial vector composed of initial values of system quantities by sampling within an initial value domain Step S3A2: According to the formula calculating the instantaneous value within the system magnitude domain at each time point within the continuous system running duration Then, the instantaneous value within the system magnitude domain at each time point is added as a sample to the positive sample set of the corresponding time period; In step S3, the negative sample set of the N time periods is constructed by the following steps: Step S3B1: obtaining an initial vector composed of initial values of system quantities by sampling outside the initial value domain Step S3B2: Calculate the instantaneous value outside the system quantity value range at each time point within the continuous system running duration according to the formula Calculate the instantaneous value outside the system quantity value range at each time point within the continuous system running duration Then, the instantaneous value within the system quantity value range at each time point is added to the counterexample sample set of the corresponding time period as a sample. wherein, The time points corresponding to the jth time period are (j*M-M)*dT, (j*M-M+1)*dT, (j*M-M+2)*dT, …, (k*M)*dT, j=1, 2, 3, …, N; and Yi and Yi represent the instantaneous value within the system magnitude domain and the instantaneous value outside the domain at the time point i*dT, respectively; wherein i = 1, 2, 3,..., N*M, T is the length of the continuous system operation; F is a differential equation of the system variables with respect to time; M is a time point fine division number in a time period.
3. The stream tube approximation generation method of claim 1, wherein, In step S4, training the simulation deep neural network with the samples in the positive sample set and the negative sample set comprises the following steps: Step S41: inputting the samples in the positive sample set and the negative sample set into the simulation deep neural network one by one to obtain corresponding outputs of each sample; Step S42: calculating positive loss function values and negative loss function values; Step S43: updating the simulation deep neural network according to the positive loss function values and the negative loss function values. Step S43: optimizing the parameters of the simulation deep neural network with the sum of the positive example loss function value and the negative example loss function value as the loss function value of the optimizer; Step S44: repeating steps S41 to S44 until the sum of the positive example loss function value and the negative example loss function value is 0; The positive example loss function value and the negative example loss function value are calculated according to the following formula: wherein, denotes the positive example loss function value for the t-th round of training, a counterexample loss function value for the t-th round of training, represents the output obtained by inputting the kth sample in the positive example sample set into the simulation deep neural network; represents the output obtained by inputting the kth sample in the counterexample sample set into the simulation deep neural network; NP is the number of samples in the positive example sample set; NN is the number of samples in the negative example sample set; max and min represent the maximum and minimum values, respectively.
4. The stream tube approximation generation method of claim 2, wherein, The steps S3A1 and S3B1 generate the initial vector and When the initial value domain boundary is fine divided around the initial value.
5. A neural network based stream tube approximation generating apparatus, characterized by The device comprises the following modules: Module M1, configured to: acquire information of a continuous system to be processed; the information of the continuous system at least comprising system variables, differential equations of the system variables with respect to time, initial value domains of the system variables, and a running time length of the continuous system; Module M2, configured to: divide the running time of the continuous system into N time periods in an equal time length manner according to the running time length, and construct simulation deep neural networks of the continuous system for the N time periods, respectively; Module M3, configured to: simulate the running of the continuous system through sampling of the system variables within and outside the initial value domains, and construct positive example sample sets and negative example sample sets for the N time periods, respectively; the positive example sample sets and the negative example sample sets are both sample sets; the samples are sampled values of the system variables; in the positive example sample sets, the sampled values of the system variables are obtained based on the sampling of the system variables within the initial value domains and the simulation running of the continuous system; in the negative example sample sets, the sampled values of the system variables are obtained based on the sampling of the system variables outside the initial value domains and the simulation running of the continuous system; Module M4, configured to: input the samples in the positive example sample sets and the negative example sample sets of the N time periods into the simulation deep neural networks of the N time periods as training sample inputs of the simulation deep neural networks, respectively, to train the simulation deep neural networks; Module M5, configured to: extract model parameter data of the N trained simulation deep neural networks, and construct hybrid integer constraint encodings corresponding to the N time periods and describing simulation deep neural network maximum output problems according to the extracted model parameter data, and then perform constraint solving of the simulation deep neural network maximum output problems on the hybrid integer constraint encodings through a hybrid integer programming constraint solver to obtain corresponding extreme values and extreme points; If the extreme value is greater than zero, the corresponding extreme point is added to the corresponding negative example sample set, and the simulation deep neural network is further trained until the corresponding extreme value is less than or equal to zero; The simulation deep neural network comprises an input layer, n hidden layers, and an output layer, and is represented as: A out = w out z n + b out ; z k = δ(w k z k-1 + b k ), k = 1, 2,..., n; z0=x; wherein A out is the output of the simulated deep neural network; w out and b out are the output layer parameters of the simulated deep neural network, w out is a vector, b out is a numerical value; w k and b k are the parameters of the kth hidden layer of the simulated deep neural network, are vectors, where k = 1, 2,..., n; z k Simulate the output vector of the kth hidden layer of the deep neural network, where k = 1, 2, …, n. z0 is an input layer output vector of the simulation deep neural network; x is a vector composed of system variables; n represents the number of hidden layers of the simulation deep neural network; δ is an activation function.
6. The stream tube approximation generation apparatus of claim 5, wherein, In the module M3, the positive example sample sets of the N time periods are constructed through the following module: Module M3A1 for: obtaining an initial vector of system quantities by sampling an initial value domain Module M3A2, configured to calculate the instantaneous value within the system magnitude domain at each time point within the continuous system running duration according to the formula Then, the instantaneous value within the system magnitude domain at each time point is added as a sample to the positive sample set of the corresponding time period. The negative example sample sets of the N time periods are constructed through the following module: Module M3B1 for: obtaining an initial vector of system quantities by sampling outside the initial value domain to obtain initial values of the system quantities a module M3B2 configured to calculate, for each time point within the duration of the continuous system, an instantaneous value outside the value range of the system quantity at the time point according to the formula an instantaneous value outside the value range of the system quantity at the time point then adding the instantaneous value within the value range of the system quantity at each time point as a sample to the counterexample sample set of the corresponding time period; wherein, The time points corresponding to the jth time period are (j*M-M)*dT, (j*M-M+1)*dT, (j*M-M+2)*dT, …, (j*M)*dT, j=1, 2, 3, …, N; and respectively represent the instantaneous value within the system magnitude domain and the instantaneous value outside the domain at the time point i*dT. wherein i = 1, 2, 3,..., N*M, T is the length of the continuous system operation; F is a system of differential equations with respect to time; M is the number of fine divisions of time points in a time period.
7. The stream tube approximation generation apparatus of claim 5, wherein, In the module M4, training the simulation deep neural network with the samples in the positive sample set and the negative sample set comprises the following modules: The module M41 is configured to input the samples in the positive sample set and the negative sample set into the simulation deep neural network one by one to obtain the output corresponding to each sample. The module M42 is configured to calculate the positive loss function value and the negative loss function value. The module M43 is configured to optimize the parameters of the simulation deep neural network with the sum of the positive loss function value and the negative loss function value as the loss function value of the optimizer. The module M44 is configured to repeatedly execute the functions of the modules M41 to M44 until the sum of the positive loss function value and the negative loss function value is 0; the positive loss function value and the negative loss function value are calculated according to the following formula: wherein, represents the positive example loss function value of the t-th round of training, a counterexample loss function value for the t-th round of training, represents the output obtained by inputting the kth sample in the positive example sample set into the simulation deep neural network; represents the output obtained by inputting the kth sample in the counterexample sample set into the simulation deep neural network; NP is the number of samples in the positive sample set; NN is the number of samples in the negative sample set; max and min represent the maximum value and the minimum value, respectively.
8. The stream tube approximation generation apparatus of claim 6, wherein, The modules M3A1 and M3B1 generate the initial vector and When the initial value domain boundary is crossed, the refinement is performed around it.
9. A medium having stored therein a set of program instructions capable of being read by a machine, the set of program instructions comprising the steps of: When the program instruction set stored in the medium is read and executed by the machine, the machine can implement the flow pipe approximation generation method according to any one of claims 1 to 4.
10. An apparatus, comprising: The device comprises a processor and a memory connected to each other; the memory stores a program instruction set; when the program instruction set stored in the memory is read and executed by the processor, the device can implement the flow pipe approximation generation method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Unmanned ship optimal path planning method based on reachable set
CN114839966A
Flow field time history deep learning prediction method considering flow control equation constraint
CN116127844A