Structural and numerical controllability#

Kalman’s criterion tests a numerical pair \((\mathbf{A},\mathbf{B})\); Lin’s theorem tests a zero pattern: a structured system is structurally controllable iff every state is reachable from an input and the generic rank of \([\mathbf{A},\mathbf{B}]\) is \(N\) (no dilation). A star driven from its hub shows both conditions: without self-loops the leaves form a dilation; with self-loops the pattern is structurally controllable, yet a realization with identical leaf dynamics is not, because two leaves that behave the same cannot be told apart by one input. Almost every other realization is controllable.

A star driven from its hub#

import matplotlib.pyplot as plt
import numpy as np

import nocad
from nocad.plotting import draw_network
from nocad.structural import controllable_subspace_dimension, is_structurally_controllable, random_realization

n_leaves = 3
star = np.zeros((n_leaves + 1, n_leaves + 1))
star[0, 1:] = 1                                   # hub x1 -> leaves
loops = star + np.diag(np.r_[0, np.ones(n_leaves)])  # leaves with self-loops
b = np.zeros((n_leaves + 1, 1))
b[0] = 1

# [snippet:lin]
for name, net in (("star", star), ("star with self-loops", loops)):
    A = net.T                                     # state matrix of the network
    print(f"{name:22s} structurally controllable: {is_structurally_controllable(A, b)}")
A_same = loops.T.copy()
A_same[np.arange(1, n_leaves + 1), np.arange(1, n_leaves + 1)] = -1.0   # identical leaves
print("identical leaves, Kalman dimension:", controllable_subspace_dimension(A_same, b))
A_diff = A_same.copy()
A_diff[np.arange(1, n_leaves + 1), np.arange(1, n_leaves + 1)] = [-1.0, -2.0, -3.0]
print("distinct leaves,  Kalman dimension:", controllable_subspace_dimension(A_diff, b))
# [/snippet:lin]

pos = np.array([[0.0, 0.0]] + [[np.cos(t), np.sin(t)] for t in np.pi / 2 + 2 * np.pi * np.arange(n_leaves) / n_leaves])
fig, axes = plt.subplots(1, 2, figsize=(7.0, 3.3))
draw_network(star, pos, ax=axes[0], drivers=[0], node_size=420, font_size=9)
axes[0].set_title("star: dilation, not controllable\nfrom the hub", fontsize=9)
draw_network(loops, pos, ax=axes[1], drivers=[0], node_size=420, font_size=9, draw_loops="arc")
axes[1].set_title("star with self-loops: structurally\ncontrollable from the hub", fontsize=9)
fig.tight_layout()
star: dilation, not controllable from the hub, star with self-loops: structurally controllable from the hub
star                   structurally controllable: False
star with self-loops   structurally controllable: True
identical leaves, Kalman dimension: 2
distinct leaves,  Kalman dimension: 4

Parameter study: how often is a realization controllable?#

Random realizations of the self-looped star with leaf dynamics drawn from a finite set of values: when two leaves get the same value the realization is uncontrollable. The fewer distinct values, the more often this happens; with continuous values (the last point) every realization is controllable, as Lin’s theorem promises “almost always”.

rng = np.random.default_rng(0)
levels = [1, 2, 3, 5, 10, 50]
share = []
for k in levels:
    ok = 0
    for _ in range(300):
        A = random_realization(loops.T, rng).toarray()
        A[np.arange(1, n_leaves + 1), np.arange(1, n_leaves + 1)] = -rng.integers(1, k + 1, n_leaves)
        ok += controllable_subspace_dimension(A, b) == n_leaves + 1
    share.append(ok / 300)
cont = np.mean([controllable_subspace_dimension(random_realization(loops.T, rng), b) == n_leaves + 1
                for _ in range(300)])
fig, ax = plt.subplots(figsize=(5.0, 3.2))
ax.plot(range(len(levels)), share, marker="o", color=nocad.plotting.PALETTE[0], label="leaf values from a finite set")
ax.axhline(cont, color=nocad.plotting.PALETTE[2], ls="--", label="continuous random values")
ax.set_xticks(range(len(levels)))
ax.set_xticklabels(levels)
ax.set_xlabel("number of possible leaf values")
ax.set_ylabel("controllable realizations")
ax.set_ylim(0, 1.05)
ax.set_title("structurally controllable, numerically not always", fontsize=10)
ax.grid(True, color="0.9")
ax.legend(frameon=False, fontsize=8, loc="lower right")
fig.tight_layout()
structurally controllable, numerically not always

Take-away. Structural controllability is a property of the pattern that holds for almost all parameter values; symmetries of the actual parameters (identical units) can still destroy controllability, which only a numerical test detects.

Total running time of the script: (0 minutes 0.552 seconds)

Gallery generated by Sphinx-Gallery