Note
Go to the end to download the full example code or to run this example in your browser via Binder.
An operability dashboard#
nocad.viz.plot_operability_summary() combines four views of one network: the SCC
hierarchy with the designed inputs and outputs, the control and observation depth maps
and the operability plane. Here it is applied to a random scale-free network with
self-loops on a share of its nodes.
One call, four panels#
import matplotlib.pyplot as plt
import nocad
from nocad.datasets import make_random_network
from nocad.viz import plot_operability_summary
net = make_random_network(40, 1.6, kind="scale_free", self_loops=0.3, random_state=2)
# [snippet:summary]
fig = plot_operability_summary(net.adj, method="path_finding", title="scale-free network, 40 states")
# [/snippet:summary]

Parameter study: the design method#
The exact minimum may need fewer dedicated driver nodes than path finding; the counts for the same network:
for method in ("matching", "signal_sharing", "path_finding", "minimum"):
d = nocad.InputOutputDesign(method).fit(net.adj)
print(f"{method:15s} inputs={d.n_inputs_:2d} drivers={d.n_drivers_:2d} outputs={d.n_outputs_:2d} "
f"sensors={d.n_sensors_:2d} controllable={d.is_controllable()} observable={d.is_observable()}")
plt.show()
matching inputs= 9 drivers= 9 outputs= 9 sensors= 9 controllable=False observable=False
signal_sharing inputs= 9 drivers=14 outputs= 9 sensors=12 controllable=True observable=True
path_finding inputs=14 drivers=14 outputs=11 sensors=11 controllable=True observable=True
minimum inputs=14 drivers=14 outputs=11 sensors=11 controllable=True observable=True
Take-away. A single figure answers the questions a designer asks first: where must the inputs and outputs go, how deep is the network, and which states are hard to reach.
Total running time of the script: (0 minutes 0.844 seconds)