Deterministic and probabilistic algorithms for stabilizing discrete-time switched linear systems

In this article we study algorithmic synthesis of the class of stabilizing switching signals for discrete-time switched linear systems proposed in [12]. A weighted digraph is associated in a natural way to a switched system, and the switching signal is expressed as an infinite walk on this weighted digraph. We employ graph-theoretic tools and discuss different algorithms for designing walks whose corresponding switching signals satisfy the stabilizing switching conditions proposed in [12]. We also address the issue of how likely/generic it is for a family of systems to admit stabilizing switching signals, and under mild assumptions give sufficient conditions for the same. Our solutions have both deterministic and probabilistic flavours.


Introduction
A switched system comprises of two components -a family of systems and a switching signal. The switching signal selects an active subsystem from the family at every instant of time [18, §1.1.2], and the family of systems may contain nonlinear dynamics, systems with delays, etc. Switching signals are broadly classified as time-dependent (depends only on time), state-dependent (depends on state as well), and with memory (also depends on the history of active subsystems) [19].
In this article we stay within the confines of discrete-time switched linear systems with purely time-dependent switching signals. Stability of such systems has been studied extensively by researchers over the past few decades, see e.g., [19,23,9,18] for detailed surveys. This study can be broadly classified into two categories -stability under arbitrary switching and stability under constrained switching. In the former category, conditions on the family of systems are identified such that the resulting switched system is This paper was not presented at any IFAC meeting. Corresponding author Atreyee Kundu. Tel. +91-22-25764892. Fax +91-22-25720057. N. Balachandran was supported in part by the grant 12IRCCSG016 from IRCC, IIT Bombay. D. Chatterjee was supported in part by the grant 12IRCCSG005 from IRCC, IIT Bombay.
asymptotically stable under all admissible switching signals [6,16,15,14,3,1]; in the latter category, given a family of systems, conditions on the switching signals are identified such that the resulting switched system is asymptotically stable [12,27,19].
Our focus in this article is on stability of discrete-time switched linear systems under constrained switching [12,13]. Stability conditions in this direction primarily rely on the idea of slow switching vis-a-vis (average) dwell time switching. These results were originally developed in the context of continuous-time switched systems, but they can be readily extended to the discrete-time setting [10], [18,Chapter 3], with the (average) dwell time expressed in terms of the number of time steps [19]. This classical theory pertains to switched systems in which all subsystems are stable. In case there are unstable systems, slow switching alone is not sufficient to guarantee stability of the switched system, and additional conditions are required to ensure that the switched system does not spend too much time on the unstable subsystems; see e.g., [19]. Departing from this set of results, in [27] the authors study global exponential stability of a discrete-time switched linear system in which not all subsystems are Schur stable (or possibly no subsystem is Schur stable) but the unstable subsystems form a stable combination. The characterization of the stabilizing switching signal in this new setting involves a modified definition of average dwell time [18,Chapter 3], [27], and the rule of activating the Schur stable subsystems (if any) arbitrarily but activating the unstable subsystems depending on a prespecified ratio.
In [12] the authors present a general class of switching signals for global asymptotic stability of switched linear systems. Our conditions involve only certain asymptotic properties of the switching signal and do not involve nor imply point-wise bounds on the number of switches -unlike in the case of average dwell time switching. Consequently, there is plenty of flexibility insofar as the transient behaviour of the switching signals are concerned. Although this is not the first instance when unstable systems in the family are considered (e.g., [27]), to the best of our knowledge, this is the first instance when unstable systems in the family are considered and the stabilizing conditions depend only on asymptotic behaviour of the switching signal. On the one hand, our conditions require the presence of at least one asymptotically stable system in the family and is therefore "conservative" compared to the ones in the literature that accommodate families with all unstable systems (e.g., [27]). On the other hand, we do not require the unstable systems in the family to form an asymptotically stable combination. The conditions proposed in [12] are also numerically easier to verify than verifying semidefinite programming based conditions (e.g., [16]) on the given family of systems.
In this article we address the important aspect of existence and algorithmic synthesis of the class of stabilizing switching signals proposed in [12]. Given a family of systems, the aspect of algorithmic synthesis of a class of stabilizing switching signals is important for obvious reasons and is not new in the switched systems literature, see e.g., [11], where randomized algorithms to synthesize stabilizing statedependent switching rules for multimodal systems are presented, and [21], where the authors propose optimizationbased methods to verify the average dwell time property. In [12] the authors provide a partial solution towards existence and algorithmic synthesis of the class of stabilizing switching signals under consideration. Here we extend the proposed techniques further and provide an array of results.
The overarching contributions of this article are twofold, the first of which addresses the following pair of questions: • Towards answering (a) and (b), we employ graph-theoretic terminology and arguments in our analysis. A weighted digraph is associated to a family of subsystems and the admissible transitions between them, and a switching signal is represented by an infinite walk on the above digraph, both in a natural way; see §2.2 for precise details. We are interested in the class of infinite walks corresponding to the class of stabilizing switching signals proposed in [12]. We shall henceforth freely switch between systemtheoretic and the corresponding graph-theoretic terminology in the above sense.
• We propose sufficient conditions for the desired infinite walk to admit what we call a closed contractive walk, the latter necessarily of finite length, and also discuss algorithmic detection/design of such walks. A closed contractive walk gives rise to an infinite walk corresponding to a stabilizing switching signal in a natural way, as we shall see momentarily.
• Given a weighted digraph, we provide two necessary and sufficient conditions for the existence of the aforementioned closed contractive walk in terms of a contractive circuit and a contractive cycle. For a contractive circuit we discuss an algorithm based on a linear program to detect such a circuit, and if it exists, we construct it algorithmically. For a contractive cycle we show that it is equivalent to detecting/designing a cycle of "negative weight" and employ standard algorithms for the same. See §3 for details.
The second major contribution of this article is towards posing and answering a more ambitious question: (c) What class of switched systems admits the class of switching signals that satisfy the conditions proposed in [12,Theorem 1]?
• This question necessarily entails a shift in paradigm: while (a) and (b) dealt with conditions for a "given" switched system, (c) seeks to identify a suitable "class of switched systems". At the level of generality that (c) pertains to, there are two natural candidate apparatuses to turn to for providing its answers -Baire category theory and probability. We turn to the latter, and under mild conditions provide a randomized algorithmic mechanism to identify a class of switched systems that satisfy the conditions proposed in [12, Theorem 1]. • Our contributions in this direction, presented in §4, may be viewed from the following four perspectives: Firstly, our algorithm detects cycles on (the underlying digraph of) switched systems that are "typical" with high probability, and under mild conditions we guarantee that such cycles are contractive. Secondly, the deterministic algorithms that are employed for answers to (a) and (b) above may not be applicable to switched systems whose underlying digraphs are large, especially if their sizes are so large that not all the weights can be kept in memory at once. For such large digraphs our algorithm provides probabilistic guarantees in the spirit of randomized algorithms for detection and design of contractive cycles. Thirdly, and in cue with the preceding point, our algorithm is of an "online" nature in the following way: starting with a rough probabilistic description of the underlying weighted digraph, (i.e., without knowledge of the precise values of the weights,) we explore the digraph and synthesize a cycle during this exploration that is contractive with high probability. On the other hand, the traditional algorithms for detecting cycles require complete knowledge of the digraph and the vertex and edge weights a priori. Fourthly, if the constituent subsystems of a switched systems are prone to evolve over time in a manner that is not precisely known but certain statistical estimates of the nature of evolution are available, our algorithm applies and constructs a contractive cycle with uniform probabilistic guarantees over all such evolutions. See §4 for details.
The remainder of this article is organized as follows: In §2 we briefly recall the class of stabilizing switching signals proposed in [12] and formulate the problems under consideration. Our main results appear in §3 and §4. We provide numerical examples in §5. We conclude in §6 with a brief discussion on future directions. The proofs of our main results are provided in a consolidated fashion in §7.
Notation. N = {1, 2, · · · } is the set of natural numbers, N 0 = {0} ∪ N, and R is the set of real numbers. For a finite set M, |M| denotes its cardinality and M N denotes the disjoint union of M with another finite set N.

Preliminaries
We consider a family of discrete-time linear systems where x(t) ∈ R d is the vector of states at time t, P = {1, 2, · · · , N} is a finite index set, and A i ∈ R d×d is a known constant full-rank matrix for each i ∈ P. Let σ : N 0 → P be a switching signal that specifies at every time t, the index of the active subsystem from the family (1). The discretetime switched linear system generated by the given family of systems (1) and the switching signal σ is given by Given a family of systems (1), in [12] the authors identify a general class of switching signals σ that admits a crisp characterization under which the resulting switched system (2) is globally asymptotically stable. Recall that by definition, the switched system (2) is globally asymptotically stable (GAS) for a given switching signal σ if (2) is • Lyapunov stable, and • globally asymptotically convergent: ∀ x(0), lim t→+∞ x(t) = 0.
Preparatory to our results, we begin with: 2.1 Properties of the family (1) Let P S and P U ⊂ P be the sets of indices of the asymptotically stable and unstable systems in the family (1), respectively.
Fact 1 ([12, Fact 1]) For each i ∈ P there exists a pair (P i , λ i ), where P i ∈ R d×d is a symmetric and positive definite matrix, and • if i ∈ P S , then 0 < λ i < 1; • if i ∈ P U , then λ i > 1; , t ∈ N 0 , where γ i (·) solves the i−th recursion in (1), i ∈ P. We call V i , i ∈ P, Lyapunov-like functions.
Fact 2 ([12, Fact 2, Proposition 1]) There exist numbers µ i j > 0 such that V j (ξ) ≤ µ i j V i (ξ) for all ξ ∈ R d , whenever it is admissible to switch from i to j, i, j ∈ P. In particular, the smallest such constants µ i j are given by where for a matrix M ∈ R n×n having real spectrum, λ max (M) denotes its maximal eigenvalue.

Properties of the switching signal
We associate a weighted digraph G(P, E(P)) with a switched system in the following fashion: • The index set P denotes the set of vertices of G, • The set of edges E(P) of G consists of: a directed edge from i to j, i, j ∈ P, whenever a switching from system i to system j is admissible, and a self-loop at vertex j, j ∈ P, whenever it is admissible to dwell on system j for at least two consecutive time steps.
We may abbreviate G(P, E(P)) by G if there is no risk of confusion. Recall that a walk W on a digraph G(V, E) [4, p. 4] is an alternating sequence of vertices and edges The initial vertex of W is x 0 and the final vertex of W is x . If x 0 = x , we say that the walk is closed. In this article we follow the convention: if all its edges are distinct. W is said to be a cycle if the vertices x i , 0 < i < are distinct from each other and x 0 . The length of a walk [4, p. 5] is its number of edges, counting repetitions, e.g., in the above case W the length of the walk W is . In the sequel by the term infinite walk we mean a walk of infinite length, i.e., it has infinitely many edges. An initial subwalk W of a walk W is an initial segment of W, which we write as W ≤ W. The following essentially obvious fact associates a switching signal σ to an infinite walk on the weighted digraph G: The set of switching signals σ : N 0 → P and the set of infinite walks on G(P, E(P)) (defined as above) are in bijective correspondence.
For a walk W on G: • Let N W be the number of distinct vertices that appear in W, and define to be the transition frequency of W; • we define the function where {k → } W and { j} W denote the number of times the edge (k, ) and the vertex j appear in W, respectively.

The main result of [12]
In the light of Fact 3 we rephrase [12, Theorem 1] in the following manner: Theorem 4 ([12, Theorem 1]) Consider the underlying weighted digraph G of the switched system (2). The switched system (2) is GAS under all switching signals σ, whose corresponding infinite walks (à la Fact 3) W satisfy and where ν(W ) and Ξ(W ) are as defined in (3) and (4), respectively.
Remark 5 Since we are in the discrete-time setting, the association (à la Fact 3) of the length of a walk with time is natural. Condition (5) in the above theorem corresponds to the condition that the switching frequency of σ is not asymptotically vanishingly small [12,Theorem 1]. In the presence of unstable systems in (1), this condition is necessary to ensure that the switched system (2) does not eventually adhere to an unstable system. The first term in the numerator of Ξ(W ) captures the number of times each admissible transition (k, ) ∈ E(P) occurs in σ till time t, weighted by w(k, ) = ln µ k , where µ k is as in Fact 2. The term captures the number of times system j ∈ P S (resp. P U ) is activated till time |W| = t by σ, weighted by ln λ j , where λ j obeys Fact 1.

Remark 6
Of course there is an element of "choice" in the selection of the Lyapunov-like functions in Fact 1 and consequently, λ i 's and µ i j 's are not unique. Ideally one would like to algorithmically determine the possibility of co-designing the matrices P i 's and the scalars λ i 's such that switching signals satisfying (6) exist, and if so, to construct such a switching signal. This particular co-design problem, to our knowledge, is numerically difficult and in the absence of a numerical solution to it, we consider the matrices P i 's and the scalars λ i 's as given, and focus on algorithmic synthesis of switching signals satisfying (6).
Given a family of systems (1), both (a) the admissible transitions (connectivity of G), and (b) the edge and vertex weights of G play a role in determining whether there exists an infinite walk W that satisfies (6). Indeed: (3,2)}. In this case, even without the knowledge of the edge and vertex weights, we can conclude that there exists no infinite walk on G that satisfies condition (6) (6) is not satisfied.
In view of the above observations, given the underlying weighted digraph of the switched system (2), we arrive at the important and natural question: Problem A Given a weighted digraph G(P, E(P)), does there exist an infinite walk W on G(P, E(P)) that satisfies (6)? If yes, can we provide a mechanism to detect/synthesize it?
In the language of switched systems, of course, Problem A is: "Does there exist a switching signal σ satisfying (6)? If such a σ exists, then can we provide an algorithmic mechanism to detect/synthesize it?" Remark 7 It is important to clarify what we mean by algorithmic solutions to Problem A. We provide an algorithm that consists of (i) a finite walk W 0 of length n 0 > 0, and (ii) an iterative process consisting of a mechanism requiring a bounded quantum of memory, to generate finite walks W k of length n k > 0, k ∈ N, satisfying the condition that the final vertex of W k−1 is identical to the initial vertex of W k for each k. We build the infinite walk W as the limit of Suppose that for a weighted digraph G there is a self-loop at a vertex j ∈ P S . Consider a walk W on G such that it begins at this vertex j and keeps on traversing that self-loop repeatedly. In this case w( j, j) = 0 by Fact 2 and no vertex j ∈ P U is visited. Consequently, the infinite walk generated satisfies (6). Given a weighted digraph G, the above walk W can be obtained from an algorithm that detects the above vertex j ∈ P S . However, given a weighted digraph G, detection of an infinite walk W satisfying (6) is not simple beyond the above trivial case. Indeed, finding an infinite walk on G that satisfies some prespecified condition involving the vertex and edge weights of G is a computationally difficult problem. We define Given a weighted digraph G, we provide: Solution A We establish a sufficient condition for the existence of an infinite walk satisfying (6) in terms of a closed contractive walk (necessarily of finite length) on G. This settles Problem A. We propose algorithmic techniques for synthesis of the above closed walk. Towards this, we derive a set of necessary and sufficient conditions in terms of a contractive circuit and a contractive cycle for the existence of a closed contractive walk on G, and apply numerically tractable algorithms to detect/design this circuit and/or cycle on G.
Moving a step ahead from Problem A, and entailing a shift in paradigm, we pose: Problem B What class of weighted digraphs admits an infinite walk that satisfies (6)?
At the level of abstractness that Problem B pertains to, there are two natural apparatuses to turn to: the first is the Baire Category theorem and its consequences, and the second is probability theory. Considering the ensemble of switched systems as the sample space, we ask how likely is a switched system sampled from this ensemble to admit closed contractive switching signals, and to Problem B we provide: Solution B We propose a polynomial time algorithm that detects a cycle of a certain fixed maximal length on G. Under mild assumptions on the connectivity and the weights associated to the vertices and edges of G we provide probabilistic guarantee that the above cycle is contractive. Other perspectives and salient features of our algorithm have already been mentioned in the Introduction. Solution A and Solution B are provided in the following two sections 3 and 4, respectively.

Solution A
In this section we expose Solution A. Since our solutions must be algorithmic (see Remark 7), we specialize to finitary objects directly in: Lemma 9 ([12, Theorem 2(a)]) Consider the underlying weighted digraph G(P, E(P)) of the switched system (2). If there exists a closed contractive walk W on G(P, E(P)), then the infinite walk obtained by repeating the closed walk W satisfies (6).
The task of algorithmic detection of a closed contractive walk on G is computationally simpler under Lemma 9 since the length of the walk is finite.

Convention 10
The total number of times a closed walk W visits a vertex j ∈ P is the same as the total number of times W visits the outgoing edges of the vertex j ∈ P. Consequently, for a vertex j ∈ P, { j} W can be replaced by { j → } W . Since we are concerned with an infinite walk constructed by repeating the closed contractive walk W indefinitely many times, the above convention is no loss of generality.
Following Convention 10, the condition (7) becomes The mechanism explained in Remark 7 shows that for a walk W generated by concatenating the walks W 1 and W 2 satisfying the usual contractivity condition, we have Ξ(W) = Ξ(W 1 ) + Ξ(W 2 ).
However, algorithmic detection of a closed contractive walk on G is also difficult due to the absence of a bound on the length of the closed walk W. Consequently, the length at which the algorithm that attempts to detect a closed contractive walk should terminate must be specified and its selection is a difficult task a priori. A natural alternative is to specialize the closed walk W to a walk of bounded length, for example, a circuit or a cycle. Our first main result provides necessary and sufficient conditions for the existence of a closed contractive walk on G in terms of a contractive circuit and a contractive cycle: Theorem 11 Consider the underlying weighted digraph G(P, E(P)) of the switched system (2) as discussed in §2. The following are equivalent: i) G(P, E(P)) admits a closed contractive walk, ii) G(P, E(P)) admits a closed contractive circuit, iii) G(P, E(P)) admits a closed contractive cycle.
Consequently, the infinite walk obtained by repeating one of the above satisfies (6).
See §7 for a detailed proof of Theorem 11.
Remark 12 Theorem 11 gives a set of necessary and sufficient conditions for the existence of a closed contractive walk on a given weighted digraph G. We now seek algorithms that detect/design a contractive circuit or a contractive cycle on G. This task is numerically simpler compared to detection/design of a closed contractive walk of some length that is not known a priori for obvious reasons. In the remainder of this section we address these two algorithmic detection/design issues. An algorithm that detects a contractive circuit on the given weighted digraph G is discussed in [12,Theorem 2(b) and (c)]. Here we improve upon the above algorithm to find a contractive circuit W on G that minimizes Ξ(W), if one such circuit W exists. As regard to a contractive cycle, we demonstrate the applicability of the existing algorithms in our context.

Algorithm to detect/design contractive circuits
Given a weighted digraph G, our algorithm for detection/design of a contractive circuit on G is motivated by the shortest path algorithm proposed in [22, §3.4].
Step 1 A contractive circuit W on G(P, E(P)) that minimizes Ξ(W) is obtained from the solution to the following feasibility problem in the variable η ∈ R |E(P)| : subject to where A is the node (arc) incidence matrix of G(P, E(P)). 1 Step 2 From the solution to the feasibility problem (9), a contractive circuit W on G(P, E(P)) that minimizes Ξ(W) can be obtained by the application of Hierholzer's algorithm. 2 Remark 14 a) There are two steps to the algorithm in Proposition 13: In Step 1, we employ a feasibility problem (9) to determine a contractive circuit W on G(P, E(P)) that minimizes Ξ(W), if G(P, E(P)) admits such a circuit. The feasibility problem (9) involves solving a linear program for the vector η. Even though (9) is a bona fide linear program, [22, Corollary to Theorem 13.3] guarantees that it has integer optimal solutions. In other words, the condition 0 ≤ η j ≤ 1 for all 1 ≤ j ≤ |E(P)| implies that each entry of the feasible solution vector η is either 1 or 0, corresponding to whether an edge is included in the circuit or not, respectively. By definition of a circuit, the size of the vector η is 1 The node (arc) incidence matrix A = [a i j ] [22, §3.4] of G is defined by if edge (i, j) leaves node i, i = 1, · · · , |P|, −1 if edge (i, j) enters node i, j = 1, · · · , |E(P)|, 0 otherwise. at most |E(P)|. If the feasibility problem (9) has a solution, we obtain a subgraph on G from the vector η that admits a circuit satisfying condition (8). If the feasibility problem (9) has a solution, we proceed to Step 2 and apply Hierholzer's algorithm to find such a circuit on G. Hierholzer's algorithm admits the above subgraph as input in Step 2. Recall [8, p. 57] that given an Eulerian graph G, Hierholzer's algorithm finds an Eulerian circuit of G. The applicability of this algorithm in our context is explained in detail in the proof of Proposition 13 [12, §6.2].
b) The condition Aη = 0 ∈ R |P| in the feasibility problem (9) corresponds a circuit, and this equation always has a trivial solution where vector η has all entries equal to 0. The condition |E(P)| j=1 η j ≥ 1 prevents the above trivial solution.
Remark 15 With respect to [12, Theorem 2(a) and (b)], we have modified the "objective function" in (9) above. This ensures that the solution to the feasibility problem (9) (if any) corresponds to a contractive circuit on G that minimizes Ξ(W).

Algorithms to detect/design contractive cycles
Given a weighted digraph G, the algorithmic detection/design of a contractive cycle is equivalent to finding what is commonly known as a negative cycle. Indeed, a negative cycle is one for which the sum of the edge weights is less than zero, which is precisely condition (8). A large class of algorithms is available to achieve the above; see e.g., [17,26] for detailed surveys. Perhaps the most wellknown one in this class is the Bellman-Ford-Moore algorithm, which is a shortest path algorithm, and it detects and reports negative weight cycles that are reachable from a pre-specified source vertex [5, p. 646]. In our context, the Bellman-Ford-Moore algorithm suffices insofar as the detection of a contractive cycle on G is concerned; further work is however required for constructing a negative cycle if such a cycle exists. Beyond the Bellman-Ford-Moore algorithm, a newer algorithm proposed in [25] lists all elementary negative cycles on a given weighted digraph; this particular algorithm jointly serves purposes of detection and design of negative cycles.

Remark 16
Since we are interested in detecting/designing an infinite walk that satisfies (6), algorithmically finding either a contractive circuit or a contractive cycle and designing an infinite walk by repeating the above suffices. However, the question of whether to find a contractive circuit or a contractive cycle algorithmically based on the following aspect appears to be interesting: Consider minimizing Ξ(W) in the sense of maximally negative Ξ(W) over all contractive circuits or cycles W on a given weighted digraph G.
• On the one hand, a contractive cycle is necessarily a contractive circuit. 3 On the other hand, although a contrac-tive circuit is not necessarily a contractive cycle, it necessarily contains at least one contractive cycle. 4 Consequently, a contractive circuit W on G that minimizes Ξ(W) may contain one or more contractive cycles. • The algorithm in Proposition 13 detects a contractive circuit W on G that minimizes Ξ(W). If this circuit is only a contractive cycle, then the output of the above algorithm is a contractive cycle as well. • To obtain a cycle W on G that minimizes Ξ(W) by the application of negative cycle detection/design algorithms, a two step mechanism is required: first, to list all elementary negative cycles on G (by applying the algorithm in [25]) and second, to find the most negative one from this list. • Instead of applying the above mechanism to G, we may apply it to the subgraph of G obtained from the feasibility problem (9) in Proposition 13. Since this subgraph admits a circuit W that minimizes Ξ(W), it necessarily admits the most negative cycle on G. It is immediate that considering a subgraph of G instead of G reduces both time and space complexity associated to the search of the most negative cycle.

Solution B
We first propose the following algorithm for detection of cycles in P S ; it will be utilized in Theorem 20 below to furnish certain genericity assertions (see Remark 21).

Algorithm 1
Step 1 Set k = 0. Pick j k ∈ P S uniformly at random.

Go to Step 2. Else
Pick j k+1 = j i such that j i ∈ N + P S ( j k ) and (k − i) is maximum.
Go to Step 3.
Step 3 End. In the remainder of this section we show that under mild connectivity and generic weight assumptions on the given weighted digraph G, a cycle obtained from Algorithm 1 satisfies (8) with high probability. Let Φ : N → R be a monotone increasing function.
Definition 17 A weighted digraph G(P, E(P)) is said to be for all j ∈ P; • nicely weighted if the vertex and edge weights on G satisfy the following conditions: there exist β, B > 0 satisfying 0 < β < B such that the vertex weights w( j) are independent and 0 < w( j) ≤ B with E[w( j)] = β for all j ∈ P, and there exist constants A > 0 and α < β such that for every (i, j) ∈ E(P), the edge weight w(i, j) ∈ [−A, A] and E[w(i, j)] ≤ α.

Remark 18
The condition that the vertex and edge weights w( j) and w(i, j) are uniformly bounded if G is nicely weighted is no loss of generality on account of the graph G being finite. However, it is also possible to consider the case in which the bounds on the weights depend on the size of the graph G, as explained in Remark 22 below. We stick to the simpler case for ease of exposition.
The following lemma guarantees the existence of a cycle in P S of length at least Φ(|P S |) .

Lemma 19
If the given weighted digraph G(P, E(P)) is nicely connected, then Algorithm 1 detects a cycle W on G(P, E(P)) such that all vertices in W are from P S and the length of W is at least Φ(|P S |) .
See §7 for a short proof of Lemma 19. Our final result is the following: Theorem 20 Consider the switched system (2) and the underlying weighted digraph G(P, E(P)) as described in §2. Suppose that G(P, E(P)) is nicely connected and nicely weighted. Then a cycle of length at least Φ(|P S |) on G(P, E(P)) obtained from Algorithm 1 is contractive with probability at least Consequently, the infinite walk obtained by repeating the above cycle satisfies (6).
We present a proof of Theorem 20 in §7.

Remark 21
Theorem 20 asserts that a cycle obtained via Algorithm 1 is contractive with high probability provided |P S | is large. Consequently, repeating such a cycle derived from Algorithm 1 generates an infinite walk W that, in view of Lemma 9, satisfies (6). This in turn identifies a class of switched systems (whose underlying weighted directed graph G is nicely connected and nicely weighted) that admits switching signals satisfying the conditions proposed in [12, Theorem 1] with overwhelming probability.

Remark 22
The primary engine leading to the estimate in Theorem 20 is Azuma's inequality. Our assumption of a uniform bound for the weights due to G being nicely weighted led to a uniform bound on the martingale increments (M m − M m−1 ) n m=1 in the proof of Theorem 20, and our estimate followed at once from Azuma's inequality. A more general version of Azuma's inequality may be employed in an identical fashion to cater to vertex-and edge-dependent weights, leading to a possibly sharper bound. The numerical value of the confidence with which a contractive cycle may be found, however, depends on the size of P S and the ability of the function Φ in Definition 17 to dominate the accumulation of the weights along the martingale increments.

Remark 23
Given the underlying weighted digraph G of the switched system (2), the deterministic algorithms for detection/design of a contractive cycle, as discussed in §3.2, require the complete knowledge of all the vertex and edge weights of G prior to their application. Consequently, these are ill suited for large graphs where all the weights cannot be stored in the memory at once. In contrast, Algorithm 1 explores G without prior knowledge of the vertex and edge weights and during this exploration designs a cycle, which is contractive with high probability. In particular, this lends an "online" flavour to our algorithm. Consequantly, it is suited for a class of large weighted digraphs for which deterministic guarantees are difficult or impossible to give. In addition, consider the case when certain parameters of the subsystems in the given family (1) (and consequently the vertex and edge weights of G) evolve over time in a manner that is not completely known. A cycle obtained from Algorithm 1 is contractive with high probability independent of this evolution as long as G is nicely weighted.

Numerical Examples
Example 24 This example corresponds to our Solution A. Based on our discussion regarding "contractivity" in §3, we select the algorithm in Proposition 13 to find a "most" contractive circuit. We consider the family of systems (1) with P = {1, 2, 3, 4}, where We construct the node(arc) incidence matrix A as described in (10). 5 We avoid presenting the matrix here for reasons of space. The elements of the column vector η are associated with the entries of E(P).
For the given family of systems (1), we obtain an estimate for the numbers λ i and µ i j from Fact 1 and Fact 2, respectively. and associate ln λ j and ln µ i j as vertex weights w( j) and edge weights w(i, j) of G, respectively.
Solving the feasibility problem (9) in the context of this setting with the aid of MATLAB by employing the program YALMIP [20] and the solver SDPT3 [24], we obtain the following solution: We consider the switching signal corresponding to the infinite walk obtained by repeating the above circuit W and study ( x(t) ) t∈N 0 for 100 different initial conditions chosen uniformly at random from the interval [−1000, 1000] 2 .
Example 25 This example corresponds to Solution B. Consider a nicely connected and nicely weighted directed graph G with for all j ∈ P, and • A = 2.5, B = 5, α = 0 and β = 2.5.
We extract and fix a cycle W obtained from Algorithm 1 on P S ⊂ P. The vertex and edge weights on W are sampled uniformly at random 1000 times from the intervals as stipulated in Definition 17. We calculate X n , as defined in (13) empirically for n being the length of the cycle W.
The above experiment is repeated for cycles of different length n obtained from Algorithm 1 with uniformly randomly selected initial vertex. We plot the empirical probability of {X n < 0} vs length n of the cycle in Figure 2. Observe that the detection of a contractive cycle from Algorithm 1  does not require a priori knowledge of the vertex and edge weights of G. It is evident from this example as we first fix a cycle W and then select weights from a specified interval. This is not the case with deterministic negative cycle detection algorithms, which require complete knowledge of the vertex and edge weights of G prior to their application. In addition, the weights are sampled uniformly at random 1000 times and we find high empirical probability for {X n < 0}. This highlights the feature that even if the systems in the given family are prone to evolve over time, our algorithm provides uniform probabilistic guarantees.

Conclusion
In this article we discussed several methods to algorithmically synthesize members of the class of stabilizing switching signals proposed in [12]. A weighted digraph was associated to a switched system and the switching signal is ex-pressed as an infinite walk on this weighted digraph in a natural way. In this setting we proposed a sufficient condition for the existence of an infinite walk whose corresponding switching signal satisfies the conditions in [12,Theorem 1], and discussed algorithms for the synthesis of the above infinite walk. Thereafter we tackled the question of how likely is it for a "generic" switched system to admit a stabilizing switching signal, and we identified such a class of switched systems in terms of connectivity and vertex and edge weights of the underlying weighted digraph of the switched system. Necessary conditions for the existence of the above infinite walk is currently under investigation and will be reported elsewhere.

Proofs of Main Results
Proof of Theorem 11: i) ⇒ ii) Assume that the given weighted digraph G admits a closed contractive walk W = x 0 , (x 0 , x 1 ), x 1 , · · · , x −1 , (x −1 , x 0 ), x 0 of length , but does not admit a contractive circuit. By assumption, W is not a circuit. We claim that W can be recursively decomposed into circuits.
Suppose that W has n edges, n ≥ 1, which appear more than once in W. Basis Step: Pick any one of the edges, say (x k−1 , x k ), that appears more than once in W. Obtain W 1 and W 2 such that W 1 is the subwalk generated by concatenating the following: i.e., the walk from the beginning of W till the first instance of (x k−1 , x k ) in W, and • x k , (x k , x k+1 ), x k+1 , · · · , x −1 , (x −1 , x 0 ), x 0 , i.e., the walk beginning after the last instance of (x k−1 , x k ) in W till the end of W; and W 2 = x k , · · · , x k is the subwalk generated by removing W 1 from W. Clearly, W 1 is a closed walk with at most (n−1) edges, which appear more than once, and W 2 is a closed walk with at most n edges, that appear more than once. In case n = 1, W 1 is a circuit. If in addition (x k−1 , x k ) appears exactly twice, W 2 is also a circuit. Since W satisfies Ξ(W) < 0, one of the following three conditions holds: i. Ξ(W 1 ) < 0, ii. Ξ(W 2 ) < 0, iii. both Ξ(W 1 ) and Ξ(W 2 ) < 0. Recursive Step: In case one of the first two conditions holds, we select the subwalk W i that satisfies Ξ(W i ) < 0. In case the last condition holds, we select the subwalk W i with fewer number of edges, that appear more than once. If the selected W i is a circuit, we stop; else we generate W (1) i and W (2) i by the same procedure explained in Basis Step and continue till we obtain W ( j) i , j ∈ {1, 2} as a circuit. Armed with the above claim, consider the case when a closed contractive walk W that satisfies Ξ(W) < 0 is decomposed into p circuits -W 1 , W 2 , · · · , W p . Now, since Ξ(W) < 0, at least one of the W i 's, i ∈ {1, 2, · · · , p}, satisfies Ξ(W i ) < 0. A circuit W i satisfying Ξ(W i ) < 0 is the one that we are looking for. It contradicts our assumption that there is no circuit on G that is contractive.
ii) ⇒ iii) Assume that there is a contractive circuit W = x 0 , (x 0 , x 1 ), x 1 , · · · , x −1 , (x −1 , x 0 ), x 0 of length on the given weighted digraph G but no contractive cycle. By assumption, W is not a cycle. We claim that W can be recursively decomposed into cycles. Basis Step: Step 1. Suppose x 0 appears n times other than at the first and last positions of W. If n = 0, apply Step 2 on W; else decompose W into subwalks W 1 , W 2 , · · · , W n+1 in the following fashion: • W 1 is the subwalk from the beginning of W till the first repeated instance of x 0 , • W 2 is the subwalk beginning from the first repeated instance of x 0 till the second repeated instance of x 0 , . . .
• W n+1 is the subwalk beginning from the nth repeated instance of x 0 till the end of W.
Clearly, each of the above subwalks is a circuit. Since W satisfies Ξ(W) < 0, there is at least one i, i ∈ {1, 2, · · · , n + 1} such that Ξ(W i ) < 0. Consider the W i from above that satisfies Ξ(W i ) < 0. In case there are more than one such W i 's, we select the one with the least number of vertices that appear more than once. If the selected W i is a cycle, we stop; else we proceed to Step 2.
Step 2. Pick a vertex x i , i 0 that appears more than once in W i . Consider the subwalks x i (beginning from the initial vertex of W i and ending at the first instance of x i ), and x i , (x i , x i+1 ), x i+1 , · · · , x 0 (beginning from the last instance of x i and ending at the final vertex of W i ); • W (2) i beginning from the first instance of x i and ending at the last instance of x i .
Since W i satisfies Ξ(W i ) < 0, one of the following is true: i.
Step: In case i. or ii. holds, we select the subwalk W ( j) i , j ∈ {1, 2} that satisfies Ξ(W ( j) i ) < 0. In case of the last one, we select the subwalk W ( j) i with less number of vertices, which appear more than once. If the selected W ( j) i is a cycle, we stop; else we generate W ( j)(1) i and W ( j) (2) i by the same procedure explained in Step 2 (Basis Step) and continue till we obtain a cycle.
Armed with the above claim, consider the case when a closed contractive circuit W satisfies Ξ(W) < 0 is decomposed into p cycles -W 1 , W 2 , · · · , W p . Now, since Ξ(W) < 0, at least one of the W i 's, i ∈ {1, 2, · · · , p} satisfies Ξ(W i ) < 0. A cycle W i satisfying Ξ(W i ) is the one that we are looking for. It contradicts our assumption that there is no cycle on G that is contractive.
iii) ⇒ ii) A contractive cycle W is a contractive circuit. If not, then there is at least one edge in W that is repeated. But then the corresponding vertices are also repeated, which contradicts the definition of a cycle.
ii) ⇒ i) By definition, a contractive circuit is a closed contractive walk.
The implication iii) ⇒ i) follows at once.
The last claim follows at once from Lemma 9.
Proof of Theorem 20: Since the given weighted digraph G(P, E(P)) is nicely connected, by Lemma 19 there exists cycle on G(P, E(P)) with all vertices of the cycle being in P S and the length of the cycle is at least Φ(|P S |) . Such a cycle can be detected by Algorithm 1.
In other words, with M 0 0 and A 0 0, we have The inequality (14) shows that (X k ) n k=0 is an (F k ) n k=0 strict supermartingale; the compensator process (A k ) n k=0 is, therefore, strictly decreasing.