Markov chain-based station path anomaly detection method and device, and medium
By using a Markov chain-based method for detecting anomalies in railway station routes, potential anomalies can be automatically identified and located in electronic railway station route maps. This solves the problems of high cost and low efficiency of manual review in existing technologies, and achieves efficient anomaly detection and design verification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-24
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies are prone to errors in node numbering, omissions or redundancies in the reproduction of electronic railway station route maps, and it is difficult to identify potential interlocking logic anomalies, resulting in high costs and low efficiency for manual review.
A station route anomaly detection method based on Markov chains is adopted. By collecting historical route maps to build a map library, subgraph mining and Markov chain modeling are used to calculate the sub-path generation probability, construct an empirical probability distribution model, and automatically identify and locate potential anomalies.
It achieves automated anomaly detection in the electronic reproduction stage, reduces the workload of manual inspection, improves design verification efficiency and logical consistency, adapts to the diverse design styles of different railway bureaus and stations, and avoids omissions and misjudgments by manual experience rules.
Smart Images

Figure CN121787684A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of rail transit, and in particular to a method, equipment, and medium for detecting station path anomalies based on Markov chains. Background Technology
[0002] In engineering practice, railway bureaus typically provide signaling or rail transit control companies with route plans, which the companies then need to electronically reproduce on their internal platforms. This process currently relies heavily on manual operation, requiring designers to draw and label nodes, tracks, and turnout connections one by one. Due to the increasing complexity of modern railway stations, errors are becoming more prevalent during the reproduction process, such as deviations in node subtypes, omissions in connections, or repetitions of local structures, resulting in inconsistencies between the electronic and original plans. If these human errors are not detected promptly, they can have serious consequences in subsequent interlocking logic configuration or simulation verification stages. Therefore, companies or institutions usually assign additional personnel to review the electronic route plans to reduce the risk of error propagation. However, this repetitive checking not only increases labor costs and work cycles but also still carries the risk of omissions and misjudgments.
[0003] Furthermore, even if a circuit diagram appears geometrically sound and has reasonable connection angles, problems may still exist at the interlocking logic level. For example, certain local connection methods may appear geometrically correct when engineers review the circuit diagrams, but they could lead to inconsistencies between the station structure and existing interlocking rules, or potentially cause Boolean logic conflicts or omissions. These hidden problems are often difficult to detect through manual experience or static rules. To mitigate these risks, simulation testing or individual analysis by engineers based on specific scenarios is necessary in practice. This process is highly dependent on the engineer's experience and consumes a significant amount of time.
[0004] In summary, rule-based checks, simulations, and global matching checks all consume significant manpower and struggle to simultaneously address error detection during manual reproduction and anomaly identification at the interlocking logic level. They lack statistical modeling of local structural patterns in historical circuit design data, making it difficult to quantify the rationality and commonality of a particular connection method.
[0005] The statements herein provide only background information in relation to this invention and do not necessarily constitute prior art. Summary of the Invention
[0006] The purpose of this invention is to provide a station path anomaly detection method based on Markov chains, so as to achieve accurate identification and location of potential abnormal segments in newly designed electronic route maps, and solve the problems of existing technologies that consume a lot of manpower and are difficult to accurately identify anomalies.
[0007] To achieve the above objectives, this invention provides a station path anomaly detection method based on Markov chains, comprising: S1. Collect existing electronic railway station and route maps, standardize them, and create a historical map library; S2. For the new station route map to be detected, sub-paths are extracted using the sub-graph mining method; S3. Based on the modeling idea of Markov chains, calculate the generation probability of sub-paths; S4. Collect the generation probability values of all sub-paths in the new station route map and construct an empirical probability distribution model; S5. Anomaly detection and localization.
[0008] Optionally, in step S1, the electronic railway station route map is uniformly converted into a node-edge graph structure representation G=(V,E) to form a historical map library; where V is a set of nodes, the nodes represent equipment in the route map, the equipment includes turnouts, signals, and endpoints; each node is also attached with detailed attribute information, the detailed attribute information includes main type, subtype, direction and other attributes; where E is a set of edges, each edge represents the track connection relationship between two nodes, and is attached with direction attributes.
[0009] Optionally, the standardization process includes node number normalization, edge direction and attribute unification, and isomorphic subgraph merging, forming a historical graph library with a unified structural pattern through the standardization process.
[0010] Optionally, step S2 includes the following steps: S2.1. Transform the new station route map into a node-edge graph structure representation G=(V,E) consistent with the historical map library, set the size range, and use the frequent subgraph mining algorithm to mine the subgraphs in the new station route map with the number of nodes within the size range. S2.2 Filter and constrain the mining results to extract sub-paths; S2.3 Perform subgraph isomorphic matching to quickly locate the historical structural patterns corresponding to the sub-paths in the new station route map and retrieve the relevant statistical frequencies.
[0011] Optionally, the frequent subgraph mining algorithm used is the gSpan algorithm.
[0012] Optionally, the filtering and constraint of the mining results includes the following restrictions: 1) Structural constraints are path-based: only linearly connected subgraphs with consecutive nodes and no branches are retained; 2) Start / End Restrictions: The start and end points of the path must be signals or endpoints to ensure that the path can represent possible train route segments and is consistent with interlocking logic analysis.
[0013] Optionally, in step S2.3, given the sub-path G1 = (V1, E1) in the new station route map and the graph structure G2 = (V2, E2) in the historical map library, if there exists a bijective mapping f : V1 → V2 such that: 1) The node type and attributes remain consistent, that is, for any node v ∈ V1, attr(v) = attr(f(v)); where f(v) is the function value of the bijective mapping f on node v, representing the corresponding node of node v in V2; the attr() function is an attribute query function; 2) The connection relationships of the edges are kept consistent, that is, for any edge (u, v) ∈ E1, (f(u), f(v)) ∈ E2, and conversely, for any edge (f(u), f(v)) ∈ E2, (u, v) ∈ E1, and the edge types are the same; where u and v represent two nodes in V1, f(u) and f(v) represent the corresponding nodes of node (u, v) in V2, respectively, edge (u, v) represents the edge in E1 that connects node u and node v, and edge (f(u), f(v)) represents the edge in E2 that connects node f(u) and node f(v); If both of the above conditions are met, then G1 and G2 are said to be isomorphic.
[0014] Optionally, step S3 includes the following steps: S3.1 Define the signal / endpoint-signal / endpoint path as a basic structure, and represent each sub-path as a sequence of basic structures containing one or more basic structures; treat each basic structure as an indivisible whole, while fully preserving the node types and edge connection information within the basic structure; S3.2 Treat the basic structure sequence as a state sequence of a Markov chain, with each state corresponding to a basic structure. The generation probability of a sub-path is the product of the transition probabilities of adjacent basic structures. The transition probability between adjacent basic structures is estimated based on the frequency statistically analyzed in the historical graph library.
[0015] Optionally, for a complete subpath M1→M2→…→M Q →M Q+1 Where Q≥1, M1, M2, ..., M Q M Q+1 The infrastructure defined in step S3.1 is the infrastructure determined in the sub-path. The generation probability of this sub-path is expressed as the product of the transition probabilities of adjacent infrastructures: P(M1→M2→…→M Q →M Q+1 ) = P(M1) · P(M2 | M1) ·…· P(MQ+1 |M Q ) Where P(M1) represents the prior probability of the starting point of the sub-path, P(M2 | M1), ..., P(M Q+1 |M Q ) Both represent the transition probability between adjacent basic structures; After normalizing the above generation probabilities, the final probability of the sub-path is p = log[P(M1→M2→…→M…]]. Q →M Q+1 ) ] / path length Q; If a sub-path contains only one infrastructure M1, then its final probability is p = P(M1).
[0016] Optionally, the prior probability of the sub-path starting point, i.e., the probability of the starting node of the sub-path, is calculated as follows: Suppose there are n sub-paths in the new station's route map, with their starting nodes being {a1, a2, ..., a...}. n By statistically analyzing the frequency of occurrence of each starting node in the new station area, the corresponding frequencies {y1, y2, ..., y} are obtained. n}; The probability of the starting node P(a) is defined using normalized frequency. i ): .
[0017] Optionally, the transition probability between adjacent infrastructure structures is calculated as follows: For any basic structure sequence M q →M q+1 Where 1≤q≤Q, For the historical image library, the basic structure M q Following closely behind is the basic structure M. q+1 The number of times; For the basic structure M in the historical image library q The total number of occurrences, where {(M q+1 )1, . . . , (M q+1 ) k} represents the set of all possible successor structures; Introducing prior parameters (α1, ..., α) k The Dirichlet prior distribution of α₁, ..., α₂ is Dir(α₁, ..., α₂). k Under the condition of ), based on the Bayesian estimation method, the formula for calculating the transition probability between infrastructures is:
[0018] In the formula, It is the prior parameter set (α1, ..., α k In a specific successor structure M q+1 The corresponding parameters; When a uniform prior is used, i.e., all α j = 1, the above calculation formula simplifies to:
[0019] Where k is the basic structure M q The number of candidate successor structures.
[0020] Optionally, step S4 specifically includes: Suppose there are n sub-paths in the new station route map. After step S3, the final probability value set {p1, p2, ..., p} is obtained. n By introducing the assumptions of independence, identical distribution, and the applicability of the law of large numbers and the central limit theorem, we obtain that the overall probability distribution approximately follows a normal distribution:
[0021] Where µ represents the expected value of the sub-path probability, σ 2 Let $\mathbf{p1}$ represent the variance, which is defined by $\mathbf{p2}$. n Estimate the sample mean and sample variance of}.
[0022] Optionally, step S5 specifically includes: Based on the empirical probability distribution model established in step S4, the sub-paths in the new station route map are evaluated; when the probability of some sub-paths is significantly lower than the set threshold or deviates from the historical distribution range, the connection structure corresponding to the sub-path is determined to be a potential anomaly; the anomaly is further located to the specific nodes and edges inside the sub-path.
[0023] Optionally, based on the empirical probability distribution model established in step S4, anomalies are identified by calculating the position of the probability of each sub-path in the distribution; when the probability p of a certain sub-path... i Less than µ-kσ, where k is a preset threshold, indicating that the probability p of this subpath is less than µ-kσ. i If a path falls into the tail of the distribution, it is determined that the sub-path has an abnormal risk.
[0024] To achieve the above objectives, the present invention also provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the above-described method for detecting station path anomalies.
[0025] To achieve the above objectives, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the above-described method for detecting station path anomalies is implemented.
[0026] Compared with the prior art, the present invention has at least the following beneficial effects: 1. This invention can automatically compare historical probability models during the electronic reproduction stage, promptly detect errors in node numbering, missing connections, or redundancy in the manual drawing process, and avoid the amplification effect caused by the accumulation of early errors in subsequent stages.
[0027] 2. This invention can be applied to the field of interlocking design, identifying local structures or paths that appear geometrically reasonable but may be logically incompatible, thereby reminding engineers to maintain and upgrade the interlocking rule base in a timely manner, and improving the logical consistency and security of station design.
[0028] 3. This invention establishes a probabilistic model by applying a large number of historical route maps, making anomaly detection adaptive and able to adapt to the diverse design styles of different railway bureaus and stations, avoiding omissions and misjudgments caused by manual experience rules.
[0029] 4. The detection process of this invention is highly automated, which can quickly locate potential anomalies in the early stages of design, greatly reduce the workload of manual inspection, and improve the efficiency and accuracy of overall design verification. Attached Figure Description
[0030] Figure 1 This is a flowchart of the station path anomaly detection method based on Markov chains of the present invention. Detailed Implementation
[0031] The following detailed description, in conjunction with the accompanying drawings and specific embodiments, provides a further detailed explanation of the station path anomaly detection method, equipment, and medium based on Markov chains proposed in this invention. The advantages and features of this invention will become clearer from the following description. It should be noted that the accompanying drawings are in a very simplified form and use non-precise proportions, used only to facilitate and clarify the illustration of the embodiments of this invention. Please refer to the accompanying drawings to make the objectives, features, and advantages of this invention more apparent and understandable. It should be understood that the structures, proportions, sizes, etc., depicted in the accompanying drawings are only for illustrative purposes to aid those skilled in the art and are not intended to limit the implementation conditions of this invention. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in proportions, or adjustments to the size, without affecting the effects and objectives achieved by this invention, should still fall within the scope of the technical content disclosed in this invention.
[0032] This invention provides a station path anomaly detection method based on Markov chains, comprising the following steps: S1. Historical map library construction: Collect existing electronic railway station route maps (hereinafter referred to as route maps), standardize them to ensure comparability between different route maps, and uniformly transform them into a node-edge graph structure representation.
[0033] The nodes represent equipment such as turnouts, signals, and endpoints, while the edges represent track connections.
[0034] The standardization process includes node number normalization, edge direction and attribute unification, and isomorphic subgraph merging. Through standardization, a historical graph library with a unified structural pattern is formed, which serves as the basis for subsequent probabilistic modeling.
[0035] The graph structure is specifically represented as follows: each route diagram is represented as a graph G=(V,E); Here, V is a set of nodes, each node corresponding to a key device in the route diagram, such as a turnout, signal, track, endpoint, checkpoint, etc.; each node also has detailed attribute information, typically including: 1) Main type: such as "signal", "turnout", "checkpoint", etc.; 2) Subtypes: such as "shunting signal", "double-acting turnout", "over-limit checkpoint", etc.; 3) Direction: Indicates the direction of train travel, such as up or down; 4) Other attributes: may include multiple additional information, such as "whether it is on the turnout" or "whether it is in the interlocking area", to fully describe the location and status of the equipment in the station; Here, E is the set of edges, where each edge represents a track connection between two nodes and has a direction attribute; there are three main types of edges: 1) Ordinary edge, indicating a regular track connection; 2) Reverse-reverse connection of turnouts, indicating a connection where both turnouts are in the opposite position; 3) Turnout reverse-positive connection, which means that the turnout is reversed at one end and positive at the other end.
[0036] The existing historical map library already includes route maps for approximately 1350 stations. All route maps have undergone the aforementioned standardization process, transforming and storing them as a standardized graph structure representation set, providing reliable foundational data for subsequent sub-path probabilistic modeling and anomaly detection.
[0037] S2. Sub-path mining for new stations: For the route map of new stations to be detected, sub-paths are extracted using sub-graph mining methods. To balance computational efficiency and pattern representation ability, this invention sets a scale interval [a, b], that is, only sub-paths with the number of nodes within this scale interval are mined. Frequent sub-graph mining algorithms such as gSpan can be used to enumerate the set of sub-paths.
[0038] To effectively detect potential abnormal connections, this invention focuses only on the path structure, ignoring other complex topologies such as loops and branches within the station. The rationale for this limitation is that the path is the basic unit of train operation, and any abnormal local connections are usually manifested on the path itself, rather than in loops or branch lines. Therefore, path-based detection can efficiently capture most potential anomalies while reducing computational complexity.
[0039] Step S2 specifically includes the following steps: S2.1. Transform the new station route map into a node-edge graph structure representation consistent with the historical map library, set a size range, and use the gSpan algorithm to mine the subgraph in the new station route map with the number of nodes within the size range.
[0040] Specifically, for the new station route map to be detected, it is first converted into a graph structure representation G=(V,E) consistent with the historical map library, and node type and edge type information is added to facilitate subsequent docking with the historical map library.
[0041] In the sub-path mining process, this embodiment adopts the gSpan (Graph-based Substructure patternmining) algorithm. The gSpan algorithm is a frequent subgraph mining algorithm. Its basic principle is to enumerate subgraphs in the graph space through depth-first search (DFS) and use DFS code to represent the structure of the subgraph, thereby achieving non-redundant subgraph generation and frequency detection.
[0042] The gSpan algorithm has the following characteristics: 1) No need to pre-generate candidate subgraphs; structure codes are generated directly during the search process. 2) Lexicographical order rules and pruning strategies can be used to avoid redundant calculations and improve search efficiency; 3) Supports controlling the minimum frequency of subgraph occurrence by setting the support parameter.
[0043] In this invention, for a single newly input station route map G, the support parameter is set to 1, meaning that all sub-maps appearing in the new station route map are extracted. To control the sub-map size and ensure the feasibility of the analysis, this invention further limits the range of the number of nodes to be extracted to [a, b]. In this embodiment, a=3 and b=15, meaning that only sub-maps with the number of nodes between 3 and 15 are extracted.
[0044] S2.2 Filter and constrain the mining results.
[0045] Specifically, after the mining is completed, in order to meet the needs of path analysis, this invention further filters and constrains the mining results, including the following restrictions: 1) Structural constraints are path-based: only linearly connected subgraphs with consecutive nodes and no branches are retained; 2) Start / End Restrictions: The start and end points of the path must be signals or endpoints to ensure that the path can represent possible train route segments and is consistent with interlocking logic analysis.
[0046] Using the above method, all sub-paths with analytical value can be extracted efficiently and comprehensively from the new station route map, providing input data for subsequent Markov probability calculation and anomaly detection.
[0047] S2.3, Subgraph Isomorphic Matching and Frequency Statistics.
[0048] After completing the sub-path mining of the new station route map, this invention employs a subgraph isomorphic matching method to compare the sub-paths obtained through filtering and constraints in step S2.2 with existing structural patterns in the historical graph library. Subgraph isomorphic matching refers to determining whether two graph structures are identical when their node attributes and edge connectivity simultaneously satisfy a one-to-one correspondence.
[0049] Given a new station sub-path G1 = (V1, E1) and a graph structure G2 = (V2, E2) in the historical graph repository, if there exists a bijective mapping f : V1 → V2 such that: 1) The node type and attributes are consistent, that is, for any node v ∈ V1, attr(v) = attr(f(v)); where f(v) is the function value of the bijective mapping f on node v, representing the corresponding node of node v in V2; the attr() function is an attribute query function, its input is a node object v, and its output is all the attributes of the node v. attr(v) = attr(f(v)) means that all attributes of node v in V1 and node f(v) in V2 are consistent. 2) The connection relationships of the edges are kept consistent, that is, for any edge (u, v) ∈ E1, (f(u), f(v)) ∈ E2, and conversely, for any edge (f(u), f(v)) ∈ E2, (u, v) ∈ E1, and the types of the edges (ordinary edges, turnout reverse-reverse connections, turnout reverse-positive connections) are the same; where u and v represent two nodes in V1, f(u) and f(v) represent the corresponding nodes of node (u, v) in V2, respectively, edge (u, v) represents the edge in E1 that connects node u and node v, and edge (f(u), f(v)) represents the edge in E2 that connects node f(u) and node f(v).
[0050] If both of the above conditions are met, then G1 and G2 are said to be isomorphic.
[0051] Specifically, this invention implements isomorphism determination based on the is_isomorphic function provided by the NetworkX library. This function allows for the simultaneous setting of node matching conditions and edge matching conditions, ensuring that not only is the topological structure consistent during the comparison process, but also that the multi-level attributes of the nodes (such as primary type, subtype, direction, and additional attributes) completely correspond to the types of the edges.
[0052] By using this subgraph isomorphic matching method, the historical patterns corresponding to sub-paths can be quickly located in the design of new stations, and the relevant statistical frequencies can be retrieved, providing basic support for subsequent probability estimation.
[0053] If a subpath does not have an isomorphic graph structure in the historical graph library, then its statistical frequency is 0.
[0054] S3. Sub-path Probability Calculation: Introducing the modeling concept of Markov chains, each sub-path is transformed into a sequence of states, with each state corresponding to a local structural pattern or node connection feature. Based on the statistical results of the transition frequencies of adjacent states in the historical graph library, the generation probability of the sub-path is calculated. This probability is represented by the product (or logarithmic sum) of the transition probabilities on the path, thus obtaining the path-level probability value of each sub-path.
[0055] In probabilistic modeling, a Markov chain is a stochastic process that describes a sequence of states. Its core assumption is that the current state depends only on the previous state and is independent of earlier historical states. By using the transition probabilities between states, Markov chains can estimate the probability of any sequence of states occurring, thereby quantifying the plausibility of the state sequence.
[0056] In contrast, higher-order Markov chains allow the current state to depend on multiple preceding states, thus capturing dependencies over longer distances and more accurately describing structural patterns in complex sequences. However, the state space of higher-order chains expands rapidly with increasing order, making it difficult to fully cover historical data, significantly increasing computational complexity, and leading to sparse and unstable probability estimations.
[0057] Therefore, this invention proposes a Markov chain modeling method based on basic structures in railway station route modeling. This method divides the station route map into several basic structural units, preserving the dependencies of local path combinations while effectively avoiding the state space explosion problem caused by high-order Markov chains, thus achieving a balance between rationality assessment and computational efficiency.
[0058] Step S3 specifically includes the following steps: S3.1, Basic structure definition and path division.
[0059] In station tracks, trains typically operate along designated paths, and abnormal connections often manifest as illogical combinations of local paths rather than independent anomalies at individual nodes. Therefore, this invention focuses on the connection probability between structures, rather than the transition probability of individual nodes. Its rationale is as follows: 1) Avoid excessive focus on local probabilities: If only a 0th-order Markov chain is used, i.e., node-level probabilities, the model will focus too much on the occurrence of local nodes and ignore the patterns of node combinations in the path. In this case, even if the nodes themselves are reasonable, the path combinations may not conform to historical statistical patterns, leading to misjudgments.
[0060] 2) Controlling the Dimensionality of the State Space: While using high-order Markov chains (e.g., n-order node sequences) can capture long-distance dependencies, the state space expands rapidly, leading to significant sparsity of historical data and unstable probability estimation. Using the basic structure as the state unit preserves local path information while significantly reducing the number of states, resulting in more efficient and robust computation.
[0061] 3) Aligns with train operation and interlocking logic: The basic structure itself corresponds to the train route section, and the connection probability between structures can reflect the reasonable route combination and interlocking constraints in the historical design, providing an intuitive and interpretable basis for anomaly detection.
[0062] Specifically, this invention defines signal / endpoint-to-signal / endpoint paths as a base structure, where both ends of the base structure are signals or endpoints. This includes four types of base structures: signal-to-signal paths, signal-to-endpoint paths, endpoint-to-signal paths, and endpoint-to-endpoint paths. In statistical analysis, modeling, and probability calculations, each base structure is treated as an indivisible whole. Simultaneously, the node types and edge connection information within the base structure are fully preserved, allowing for precise backtracking to specific nodes and tracks within the base structure when low-probability connections are detected, enabling localization and interpretation.
[0063] Therefore, each sub-path can be represented as a sequence of infrastructures containing one or more infrastructures.
[0064] The following is an example of path partitioning: Consider a path node sequence as: 1-2-3-4-5-6-7; The numerical nodes in the path represent different devices. Assuming that 1, 3, 5, and 7 are signal controllers, then according to the definition of the infrastructure, the path is divided into the following patterns: 1-2-3: Basic Structure A; 3-4-5: Basic Structure B; 5-6-7: Basic Structure C; The entire path can then be represented as a basic structure sequence ABC.
[0065] In probabilistic modeling, this invention focuses on the transition probabilities P(B|A) and P(C|B) between adjacent infrastructure structures, rather than node-level transitions such as node 1-2, 2-3, and 3-4.
[0066] S3.2, Calculation of Markov Chain Probability.
[0067] The basic structure sequence is viewed as a state sequence of a Markov chain, with each state corresponding to a basic structure pattern. The transition probability between adjacent basic structures is estimated based on the frequency statistically analyzed in a historical database. The specific calculation process is as follows: For any basic structure sequence M q →M q+1 (q≥1), where M q and M q+1 Based on the infrastructure definition in step S3.1, two adjacent infrastructures are determined in the sub-path. Let: In the historical image library, the basic structure M q Following closely behind is the basic structure M. q+1 The number of times; : Basic structure M in the historical image library qThe total number of occurrences, where {(M q+1 )1, . . ., (M q+1 ) k} represents the set of all possible successor structures.
[0068] Then, when introducing prior parameters (α1, ..., α...), k The Dirichlet prior distribution of α₁, ..., α₂ is Dir(α₁, ..., α₂). k Under the condition of ), based on the Bayesian estimation method, the formula for calculating the conditional probability between infrastructures is:
[0069] In the formula, It is the prior parameter set (α1, ..., α k In a specific successor structure M q+1 The corresponding parameters, i.e. Is when (M) q+1 ) j = M q+1 α at time j .
[0070] When a uniform prior is adopted (i.e., all α) j When = 1), the above conditional probability calculation formula simplifies to the classic plus-one smoothing:
[0071] Where k is the basic structure M q The number of candidate successor structures. This ensures that even if a connection does not appear in the history, its probability value will not be zero.
[0072] For a complete subpath M1→M2→…→M Q →M Q+1 M1, M2, ..., M Q M Q+1 The infrastructure defined in the sub-path based on the infrastructure definition in step S3.1, where q ≤ Q, can be represented by the product of the transition probabilities of adjacent infrastructures: P(M1→M2→…→M Q →M Q+1 ) = P(M1) · P(M2 | M1) ·…· P(M Q+1 |M Q ) Where P(M1) represents the prior probability of the initial basic structure, and its calculation and processing method will be explained in detail in subsequent step S3.3.
[0073] After obtaining the path generation probability, considering the different path lengths, it is normalized again: the final probability p = log[P] / path length. For the subpath M1→M2→…→M Q →M Q+1 The path propagates Q times, so the final probability p = log[P(M1→M2→…→M]). Q →M Q+1 ) ] / Q.
[0074] If a sub-path contains only one basic structure M1, then its final probability p = P(M1), and its calculation method will be explained in detail in subsequent step S3.3.
[0075] The following example illustrates the generation probability calculation process for a sub-path representing the basic structure sequence A → B → C: For the basic structural sequence A→B, let: In the historical image library, the number of times infrastructure A is immediately followed by infrastructure B; : The total number of times the basic structure A appears in the historical image library, where {B1, ..., B} k} represents the set of all possible successor structures.
[0076] Then, when introducing prior parameters (α1, ..., α...), k The Dirichlet prior distribution of α₁, ..., α₂ is Dir(α₁, ..., α₂). k Under the condition of ), based on the Bayesian estimation method, the formula for calculating the conditional probability between infrastructures is:
[0077] In the formula, α B It is the Dirichlet prior parameter set (α1, ..., α...). k The parameter α in the context corresponds to a specific successor structure B. B Is it B j = α at B j .
[0078] When a uniform prior is adopted (i.e., all α) j When = 1), the above conditional probability calculation formula simplifies to the classic plus-one smoothing:
[0079] Here, k is the number of candidate successor structures for the basic structure A. This ensures that even if a connection does not appear in the history, its probability value will not be zero.
[0080] The calculation method for the transition probability P(C|B) of basic structure B and basic structure C is the same as above, and will not be repeated here.
[0081] Therefore, the generation probability of the complete path A → B → C is expressed as the product of the transition probabilities of adjacent infrastructure structures: P(A → B → C) = P(A) · P(B | A) · P(C | B) Where P(A) represents the prior probability of the initial basic structure, and its calculation and processing method will be explained in detail in subsequent step S3.3.
[0082] The final probability p = log[P] / path length. For the path A → B → C, the path propagates twice, so the final probability p = log[P(A → B → C)] / 2.
[0083] Using the above method, each sub-path can obtain a probability value based on the historical map library, thereby quantifying the rationality of the path combination. Paths with low probability values often correspond to errors in the manual reproduction process or have potential unreasonable connections at the interlocking logic level.
[0084] S3.3, Calculation of the probability of the starting node.
[0085] When calculating path probabilities, it is necessary to determine the probability of the starting node of each sub-path, denoted here as P(a). Suppose there are n sub-paths in the new station design map, with their starting nodes being {a1, a2, ..., a...}. n By statistically analyzing the frequency of occurrence of each starting node in the new station area, the corresponding frequencies {y1, y2, ..., y} are obtained. n}
[0086] Based on this, the present invention uses normalized frequency to define the probability of the starting node:
[0087] The rationale for this modeling approach lies in: 1. The frequency of the starting node reflects its importance and connectivity in the overall structure of the new station area. The higher the frequency, the greater the likelihood that the node is the starting point of the path. 2. By normalizing, we can ensure that the sum of the probabilities of all starting nodes is 1, which conforms to the basic definition of a probability distribution; 3. When combined with structural transition probabilities, it can more realistically reflect the overall probability of path generation, rather than relying solely on the relative transition relationships between structures.
[0088] Therefore, for any path M1→M2→…→MQ →M Q+1 Its complete generation probability can be expressed as: P(M1→M2→…→M Q →M Q+1 ) = P(M1) · P(M2 | M1) ·…· P(M Q+1 |M Q Where P(M1) is the prior probability of the sub-path starting point, i.e., the probability of the starting node of the sub-path, calculated by the normalization method described above, and the subsequent part is given by the Markov chain transition probability introduced in step S3.2. This takes into account the differences in node distribution in the new station site, while maintaining the uniformity and interpretability of the model.
[0089] S4. Empirical probability distribution modeling: After collecting the probability values of all sub-paths in the new station map, compare them with the distribution characteristics of the historical map library to construct an empirical probability distribution model to characterize the rationality and commonality of different sub-paths in the existing design.
[0090] Specifically, after subgraph mining, isomorphic matching, and Markov chain probability calculation, each candidate sub-path in the new station design map can obtain a corresponding generation probability. Assuming there are n sub-paths in the new station, the final probability value set {p1, p2, ..., p...} is obtained after calculation. n}
[0091] To perform statistical hypothesis testing, some reasonable statistical hypotheses are introduced: 1. Independence Assumption: Assume that the probability value p of different sub-paths is... i They are "approximately independent". Although there is some overlap between the station paths (shared nodes or edges), statistically speaking, the probability of each path can be considered as the result of independent sampling from a certain potential distribution.
[0092] 2. Identical Distribution Assumption: Assume that the probability values of all paths are {p} i Since they come from the same underlying distribution (i.e., they have the same distribution pattern, mean, and variance), they can be modeled as a sample of a single random variable.
[0093] 3. Applicability of the Law of Large Numbers and the Central Limit Theorem: When n is large enough (given the current scale of the station, the station often contains more than 100 sub-paths), the sample mean and variance of these probability values will converge stably to the true distribution parameters.
[0094] Under the above statistical assumptions, since the probability of each sub-path comes from the structural statistical results of a large number of historical image databases, and the sub-paths are relatively independent, the overall probability distribution can be approximately followed by a normal distribution according to the law of large numbers and the central limit theorem:
[0095] Where µ represents the expected value of the path probability, σ 2 Variance can be represented by {p1, ..., p}. n Estimate the sample mean and sample variance of}.
[0096] S5. Anomaly Detection and Location: Based on the empirical probability distribution model established in step S4, the sub-paths in the new station map are evaluated. When the probability of certain sub-paths is significantly lower than a set threshold or deviates from the historical distribution range, the connection structure corresponding to that sub-path is determined to be a potential anomaly. The system further locates the anomaly to specific nodes and edges within the sub-path, allowing engineers to review and correct it during the electronic reproduction phase or interlocking logic verification phase.
[0097] Specifically, based on the normal distribution empirical probability model established in step S4, anomalies are identified by calculating the position of the probability of each sub-path within the distribution. When the probability p of a certain sub-path... i If a path falls into the tail of the distribution (e.g., less than µ-kσ, where k is a preset threshold, such as 2 or 3), then the subpath is determined to have an abnormal risk.
[0098] These anomalies often correspond to: 1. Errors in manually reproducing circuit diagrams, resulting in rare or non-existent local connection patterns; 2. Combination structures that are difficult to establish at the interlocking logic level, which may seem geometrically reasonable, but historical statistics show that their probability of occurrence is extremely low.
[0099] Through the above-mentioned probability distribution modeling and anomaly detection methods, this invention can statistically evaluate the overall rationality of new station routes and automatically locate potential problem areas, providing a reliable basis for subsequent design verification and logic validation.
[0100] Furthermore, the present invention also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the above-described method for detecting station path anomalies is implemented.
[0101] Furthermore, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the above-described method for detecting station path anomalies is implemented.
[0102] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0103] In the description of this invention, it should be understood that the terms "center," "height," "thickness," "upper," "lower," "vertical," "horizontal," "top," "bottom," "inner," "outer," "axial," "radial," and "circumferential," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0104] In the description of this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0105] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.
[0106] Although the present invention has been described in detail through the preferred embodiments above, it should be understood that the above description should not be considered as a limitation of the present invention. Various modifications and substitutions to the present invention will be apparent to those skilled in the art after reading the above. Therefore, the scope of protection of the present invention should be defined by the appended claims.
Claims
1. A station path anomaly detection method based on Markov chains, characterized in that, include: S1. Collect existing electronic railway station and route maps, standardize them, and create a historical map library; S2. For the new station route map to be detected, sub-paths are extracted using the sub-graph mining method; S3. Based on the modeling idea of Markov chains, calculate the generation probability of sub-paths; S4. Collect the generation probability values of all sub-paths in the new station route map and construct an empirical probability distribution model; S5. Anomaly detection and localization.
2. The station path anomaly detection method based on Markov chain as described in claim 1, characterized in that, In step S1, the electronic railway station route map is uniformly converted into a node-edge graph structure representation G=(V,E), forming a historical map library; Where V is a set of nodes, and the nodes represent equipment in the circuit diagram, including turnouts, signals, and endpoints; each node is also attached with detailed attribute information, including main type, subtype, direction, and other attributes. Here, E is a set of edges, each edge representing the track connection between two nodes, with an added direction attribute.
3. The station path anomaly detection method based on Markov chain as described in claim 2, characterized in that, The standardization process includes node number normalization, edge direction and attribute unification, and isomorphic subgraph merging, forming a historical graph library with a unified structural pattern through standardization.
4. The station path anomaly detection method based on Markov chain as described in claim 2, characterized in that, Step S2 includes the following steps: S2.
1. Transform the new station route map into a node-edge graph structure representation G=(V,E) consistent with the historical map library, set the size range, and use the frequent subgraph mining algorithm to mine the subgraphs in the new station route map with the number of nodes within the size range. S2.2 Filter and constrain the mining results to extract sub-paths; S2.3 Perform subgraph isomorphic matching to quickly locate the historical structural patterns corresponding to the sub-paths in the new station route map and retrieve the relevant statistical frequencies.
5. The station path anomaly detection method based on Markov chain as described in claim 4, characterized in that, The frequent subgraph mining algorithm used is the gSpan algorithm.
6. The station path anomaly detection method based on Markov chain as described in claim 4, characterized in that, The filtering and constraint of the mining results includes the following restrictions: The structure is restricted to paths: only linearly connected subgraphs with consecutive nodes and no branches are retained; Start / End Restrictions: The start and end points of a path must be signals or endpoints to ensure that the path represents possible train route segments and is consistent with interlocking logic analysis.
7. The station path anomaly detection method based on Markov chain as described in claim 4, characterized in that, In step S2.3, given the sub-path G1 = (V1, E1) in the new station route map and the graph structure G2 = (V2, E2) in the historical map library, if there exists a bijective mapping f : V1 → V2 such that: The node type and attributes remain consistent, that is, for any node v ∈ V1, attr(v) = attr(f(v)); where f(v) is the function value of the bijective mapping f on node v, representing the corresponding node of node v in V2; the attr() function is an attribute query function; The connection relationships of the edges remain consistent, that is, for any edge (u, v) ∈ E1, (f(u), f(v)) ∈ E2, and conversely, for any edge (f(u), f(v)) ∈ E2, (u, v) ∈ E1, and the edge types are the same; where u and v represent two nodes in V1, f(u) and f(v) represent the corresponding nodes of node (u, v) in V2, respectively, edge (u, v) represents the edge in E1 that connects node u and node v, and edge (f(u), f(v)) represents the edge in E2 that connects node f(u) and node f(v); If both of the above conditions are met, then G1 and G2 are said to be isomorphic.
8. The station path anomaly detection method based on Markov chain as described in claim 1, characterized in that, Step S3 includes the following steps: S3.1 Define the signal / endpoint-signal / endpoint path as a basic structure, and represent each sub-path as a sequence of basic structures containing one or more basic structures; treat each basic structure as an indivisible whole, while fully preserving the node types and edge connection information within the basic structure; S3.2 Treat the basic structure sequence as a state sequence of a Markov chain, with each state corresponding to a basic structure. The generation probability of a sub-path is the product of the transition probabilities of adjacent basic structures. The transition probability between adjacent basic structures is estimated based on the frequency statistically analyzed in the historical graph library.
9. The station path anomaly detection method based on Markov chain as described in claim 8, characterized in that, For a complete subpath M1→M2→…→M Q →M Q+1 Where Q≥1, M1, M2, ..., M Q M Q+1 The infrastructure defined in step S3.1 is the infrastructure determined in the sub-path. The generation probability of this sub-path is expressed as the product of the transition probabilities of adjacent infrastructures: P(M1→M2→…→M Q →M Q+1 ) = P(M1) · P(M2 | M1) ·…· P(M Q+1 |M Q ) Where P(M1) represents the prior probability of the starting point of the sub-path, P(M2 | M1), ..., P(M Q+1 |M Q ) Both represent the transition probability between adjacent basic structures; After normalizing the above generation probabilities, the final probability of the sub-path is p = log[P(M1→M2→…→M…]]. Q →M Q+1 ) ] / path length Q; If a sub-path contains only one infrastructure M1, then its final probability is p = P(M1).
10. The station path anomaly detection method based on Markov chain as described in claim 9, characterized in that, The prior probability of the starting point of the sub-path, i.e., the probability of the starting node of the sub-path, is calculated as follows: Suppose there are n sub-paths in the new station's route map, with their starting nodes being {a1, a2, ..., a...}. n By statistically analyzing the frequency of occurrence of each starting node in the new station area, the corresponding frequencies {y1, y2, ..., y} are obtained. n }; The probability P(a) of the starting node is defined using normalized frequency. i ): 。 11. The station path anomaly detection method based on Markov chain as described in claim 9, characterized in that, The method for calculating the transition probability between adjacent basic structures is as follows: For any basic structure sequence M q →M q+1 Where 1≤q≤Q, For the historical image library, the basic structure M q Following closely behind is the basic structure M. q+1 The number of times; For the basic structure M in the historical image library q The total number of occurrences, where {(M q+1 )1, . . . , (M q+1 ) k } represents the set of all possible successor structures; Introducing prior parameters (α1, ..., α) k The Dirichlet prior distribution of α₁, ..., α₂ is Dir(α₁, ..., α₂). k Under the condition of ), based on the Bayesian estimation method, the formula for calculating the transition probability between infrastructures is: ; In the formula, It is the prior parameter set (α1, ..., α k In a specific successor structure M q+1 The corresponding parameters; When a uniform prior is used, i.e., all α j = 1, the above calculation formula simplifies to: ; Where k is the basic structure M q The number of candidate successor structures.
12. The station path anomaly detection method based on Markov chain as described in claim 1, characterized in that, Step S4 specifically involves: Suppose there are n sub-paths in the new station route map. After step S3, the final probability value set {p1, p2, ..., p} is obtained. n By introducing the assumptions of independence, identical distribution, and the applicability of the law of large numbers and the central limit theorem, we obtain that the overall probability distribution approximately follows a normal distribution: ; Where µ represents the expected value of the sub-path probability, σ 2 Let $\mathbf{p1}$ represent the variance, which is defined by $\mathbf{p2}$. n Estimate the sample mean and sample variance of}.
13. The station path anomaly detection method based on Markov chains as described in claim 12, characterized in that, Step S5 specifically involves: Based on the empirical probability distribution model established in step S4, the sub-paths in the new station route map are evaluated; when the probability of some sub-paths is significantly lower than the set threshold or deviates from the historical distribution range, the connection structure corresponding to the sub-path is determined to be a potential anomaly; the anomaly is further located to the specific nodes and edges inside the sub-path.
14. The station path anomaly detection method based on Markov chains as described in claim 13, characterized in that, Based on the empirical probability distribution model established in step S4, anomalies are identified by calculating the position of the probability of each sub-path within the distribution; when the probability p of a certain sub-path... i Less than µ-kσ, where k is a preset threshold, indicating that the probability p of this subpath is less than µ-kσ. i If a path falls into the tail of the distribution, it is determined that the sub-path has an abnormal risk.
15. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the station path anomaly detection method as described in any one of claims 1-14.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the station path anomaly detection method as described in any one of claims 1-15.