Chapter 3
Maximum matching and the design of inputs and outputs
Lin’s theorem tells whether a given set of inputs makes a system controllable; this chapter turns it into a design method. A maximum matching of the state network gives the minimum number of driver nodes and, by its unmatched nodes, one place for them (the minimum input theorem of Liu, Slotine and Barabási). Matchings alone, however, overlook source components that are perfectly matched by cycles. The chapter presents the two remedies of the NOCAD toolbox, signal sharing and path finding, and an exact formulation that computes the minimum number of dedicated inputs with one more matching. Sensors follow by duality.
3.1 Problem and idea
Condition (ii) of Lin’s theorem asks for a matching that assigns a distinct parent to every state; an input can serve as the parent of one state. If a matching of the state network already assigns parents to states, the remaining states, the unmatched ones, each need an input of their own. The fewer unmatched nodes, the fewer inputs, so the matching should be as large as possible: a maximum matching. This is the minimum input theorem [10].
The theorem settles condition (ii); condition (i), accessibility, is a separate matter. Every source component of the condensation must contain a driver node, because nothing outside it can reach it. If a source component contains an unmatched node, that node is a driver node and the component is reached. If all its nodes are matched, the matching covers it by cycles, and the minimum input theorem places no input in it at all (fig. 3.1). Liu and co-authors repaired this by sending the signal of an existing input into such a component as well (signal sharing) [11]. Leitold, Vathy-Fogarassy and Abonyi observed that the defect comes from cycles of the matching that close inside a source component: by exchanging one matched edge, the cycle can be opened into a path that continues into an unmatched node outside, so that one new driver node controls both the component and the node outside, and every input drives a single state (path finding) [1].
3.2 Theory
3.2.1 Matchings in directed networks
A matching of a directed network is a set of edges no two of which share a start node or an end node; a node is matched if an edge of ends in it and unmatched otherwise. Splitting every node into an out-copy and an in-copy and every edge into an undirected edge gives the bipartite representation ; directed matchings of are exactly the matchings of . In a matching, every node has at most one incoming and one outgoing matched edge, so the matched edges form vertex-disjoint directed paths and cycles; every path starts at an unmatched node. The size of a maximum matching equals the generic rank of , and the Hopcroft–Karp algorithm finds one in time [28]. (The MATLAB toolbox obtained the matching from the Dulmage–Mendelsohn decomposition [29, 30].)
Definition 3.1 (minimum input theorem [10]). The minimum number of inputs that make structurally controllable, when an input may act on several states, is , where is a maximum matching; the unmatched nodes of are a set of driver nodes.
The theorem relies on the freedom to let one input act on several states: in a perfectly matched source component the extra signal needed for accessibility comes from an existing input. The number of driver nodes is unique, their positions are not: a network generally has many maximum matchings, and chapter 5 studies what they have in common. Sensor nodes are obtained by the same construction on the reversed network , since observability of is controllability of [11].
3.2.2 Signal sharing
Let be a source component all of whose nodes are matched. Signal sharing gives every unmatched node a dedicated input and adds one node of every such component to the first input. The input matrix then has columns, the first of which may contain several non-zeros. The number of inputs is minimal in the sense of the minimum input theorem; the number of driver nodes is larger by the number of shared components. Because the shared nodes depend on which maximum matching was found, the number of driver nodes can vary between runs.
3.2.3 Path finding
A matched source component is covered by cycles of . If an edge leaves toward an unmatched node , the node is matched inside by an edge . Removing from and adding keeps the size of the matching, makes unmatched, and matches : the cycle through is opened into a path that starts at the new driver node and continues into , so one input controls both. If no such edge exists, one matched edge inside is removed and its end node becomes a driver node. The method processes the components one after the other (algorithm 3.1); a component whose nodes already continue outward through a matched edge, or that contains an unmatched node, needs nothing. The number of driver nodes is the number of unmatched nodes plus the number of matched source components that cannot be opened toward an unmatched node; when several components point to the same unmatched node, only one of them can use it [1].
3.2.4 The exact minimum of dedicated inputs
Path finding is greedy: the components claim unmatched nodes in the order they are visited, and the initial maximum matching decides which nodes are unmatched in the first place. Both choices can cost driver nodes. The exact minimum follows from Lin’s theorem directly. A set of driver nodes with dedicated inputs makes controllable iff (ii) the unmatched nodes of some matching of lie in (an input is the parent of one node) and (i) every source component contains a node of . Hence
| (3.1) |
where is the number of source components and the number of source components that contain an unmatched node of . Extend the bipartite graph by one slack out-vertex per source component , joined to the in-copies of the nodes of , and call the extended graph . A matching of consists of a matching of and, for some source components, a distinct node of the component left unmatched by ; its size is at most. Every pair is realized this way, so the bound eq. (3.1) is minimized by a maximum matching of :
| (3.2) |
The bound is attained by the unmatched nodes of plus one node of every source component that leaves unhit; in such a component one matched edge is removed, so that every driver node is the start of a stem, as in path finding (algorithm 3.2). The same count was derived by Commault and Dion [31] and, as the minimum number of dedicated inputs, by Pequito, Kar and Aguiar [32]; the extended matching makes it one call of the Hopcroft–Karp algorithm.
In a nutshell: Input and output design by matching
- Unmatched nodes of a maximum matching are driver nodes (minimum input theorem); sensors come from the reversed network.
- Perfectly matched source components need extra care: signal sharing (one input, several nodes) or path finding (open a cycle into a stem).
- Path finding gives dedicated inputs; it is greedy and may exceed the minimum when components compete for the same unmatched nodes.
- The exact minimum needs one matching of the bipartite graph extended by a slack vertex per source component.
- Every design is checked by Lin’s theorem: InputOutputDesign.is_controllable().
3.3 Using it in nocad
nocad.InputOutputDesign(method="path_finding")
method: "path_finding", "signal_sharing", "minimum" (exact, algorithm 3.2) or "matching" (unmatched nodes only, for comparison). fit(adj) sets A_, B_, C_, D_ (sparse), control_matching_, observation_matching_, driver_nodes_, sensor_nodes_, shared_driver_nodes_, n_inputs_, n_drivers_, n_outputs_, n_sensors_; methods matrices(), is_controllable(), is_observable().
functions of nocad.matching and nocad.design
maximum_matching(adj) returns a Matching with matched_by, matched, unmatched, edges, size; all_maximum_matchings(adj) enumerates them for small networks; maximum_matching_pf, maximum_matching_ss and maximum_matching_min return the corrected matchings in the format of the MATLAB functions; driver_nodes(adj, method), sensor_nodes(adj, method) and generate_matrices(adj, method) give the nodes and the matrices directly.
The matching of the four-node example of the NOCAD manual:
adj = load_four_node_example().adj m = nocad.maximum_matching(adj) print("size of the matching:", m.size) print("matched edges (start, end):", (m.edges + 1).tolist()) print("unmatched (driver) nodes:", m.unmatched + 1)
The three designs of the cycle with a tail, as input matrices:
adj = make_cycle_example().adj # x1 <-> x2 -> x3 -> x4 for method in ("signal_sharing", "path_finding", "minimum"): A, B, C, D = nocad.generate_matrices(adj, method) print(f"{method:15s} B^T =", B.toarray().astype(int).T.tolist())
3.4 Examples
3.4.1 A three-cycle with a tail
The four-node network of the NOCAD manual (fig. 3.2) has matchings of size three: one node stays unmatched and one input suffices. There are two maximum matchings (fig. 3.3). The first covers the cycle and leaves the tail unmatched. The second runs the stem from through the cycle into . Both are valid designs: with the input at the cycle is a source component that receives nothing, which path finding repairs by exchanging for , the second matching. Nodes and are driver nodes in some minimum driver set, and in none.
Open in ColabExample plot_02_maximum_matching.py in the gallery
The share of driver nodes of random networks falls with the mean degree (fig. 3.4), the classical result of Liu, Slotine and Barabási [10]. Sparse networks contain many source and sink nodes and many dilations; heterogeneous (scale-free) networks need more driver nodes than Erdős–Rényi networks of the same mean degree.
3.4.2 Signal sharing, path finding and the exact minimum
For the cycle feeding the chain (fig. 3.5), the maximum matching covers the cycle and leaves unmatched. Signal sharing therefore uses one input acting on two states, and (), whereas path finding and the exact minimum use one input acting on alone ().
Open in ColabExample plot_03_path_finding_signal_sharing.py in the gallery
Two cycles that compete for the same unmatched node show where the greedy method loses (fig. 3.6). The cycle points to and , the cycle only to . Path finding opens the first cycle toward ; the second has nothing left to claim, so it is cut, and keeps its own input: three dedicated inputs. The exact minimum lets the first cycle continue to and the second to : two inputs. Signal sharing also uses two inputs, but drives four nodes.
Figure 3.7 repeats the comparison on sparse random networks with an increasing share of self-loops, which turn single nodes into strongly connected components. Signal sharing needs the fewest inputs: with self-loops on every node the matching is perfect and a single shared input remains. Counted in driver nodes with dedicated inputs, path finding stays within a few percent of the exact minimum.
3.5 Further reading
The minimum input theorem is due to Liu, Slotine and Barabási [10], its observability counterpart and signal sharing to [11], path finding to Leitold, Vathy-Fogarassy and Abonyi [1, 3]. Commault and Dion [31] and Pequito, Kar and Aguiar [32] characterize the minimal numbers of additional and of dedicated inputs; Olshevsky [33] shows that the corresponding numerical problem, the minimal controllability problem for a given matrix, is NP-hard, which underlines the value of the structural formulation. Hopcroft and Karp [28] give the matching algorithm, Dulmage and Mendelsohn [29] and Pothen and Fan [30] the decomposition behind the MATLAB implementation.