The non-positive circuit weight problem in parametric graphs: a solution based on dioid theory
TThe non-positive circuit weight problemin parametric graphs:a fast solution based on dioid theory
Davide Zorzenon a, ∗ , Jan Komenda b , J¨org Raisch a a Technische Universit¨at Berlin, Control Systems Group, Einsteinufer 17, D-10587 Berlin,Germany b Institute of Mathematics, Czech Academy of Sciences, ˘Zi˘zkova 22, 616 62 Brno, CzechRepublic
Abstract
Let us consider a parametric weighted directed graph in which every arc ( j, i )has weight of the form w (( j, i )) = max( P ij + λ, I ij − λ, C ij ), where λ is areal parameter and P , I and C are arbitrary square matrices with elements in R ∪ {−∞} . In this paper, we design an algorithm that solves the Non-positiveCircuit weight Problem (NCP) on this class of parametric graphs, which consistsin finding all values of λ such that the graph does not contain circuits withpositive weight. This problem, which generalizes other instances of the NCPpreviously investigated in the literature, has applications in the consistencyanalysis of a class of discrete-event systems called P-time event graphs. Theproposed algorithm is based on max-plus algebra and formal languages andruns faster than other existing approaches, achieving strongly polynomial timecomplexity O ( n ) (where n is the number of nodes in the graph). Keywords:
Parametric graphs; Non-positive circuit weight; Max-plus algebra;Formal languages; Dioid theory; P-time event graphs
1. Introduction
In graph theory, a classical problem is to check whether, given a weighteddirected graph, there exists a circuit with positive (or negative) weight. Oneof the simplest and most famous algorithms that solves this problem is dueto Bellman and Ford [6]. The algebraic equivalent of this problem is related tolinear inequalities in the tropical (max-plus or min-plus) algebra: given a squarematrix A in the max-plus algebra, the precedence graph G ( A ) does not containcircuits with positive weight if and only if the max-plus inequality x (cid:23) A ⊗ x ∗ Corresponding author
Email addresses: [email protected] (Davide Zorzenon), [email protected] (Jan Komenda), [email protected] (J¨org Raisch)
Preprint submitted to Elsevier February 25, 2021 a r X i v : . [ m a t h . C O ] F e b dmits a real solution x . The solution set of this kind of inequalities is oftencalled zone or weighted digraph polyhedron [21, 15]. We emphasize that theproblem can be equivalently stated in the max-plus or in the min-plus algebra.In the present paper, we consider parametric weighted directed graphs, inwhich weights of the arcs are variable and depend on some parameters. In thiscontext, we refer to the problem of finding all the values of the parameters suchthat the graph does not include circuits with positive weight as the Non-positiveCircuit weight Problem (NCP). In particular, we are interested in studying thisproblem on a subclass of parametric weighted directed graphs whose weightsdepend only on one parameter λ ∈ R .It is known from the seminal work [16] of Karp that, in a graph with constantarc weights, there are no circuits with positive weight if and only if the maximumcircuit mean of the graph is non-positive. Based on this result, the NCP has beensolved in literature in the cases when the weights of the arcs depend proportion-ally ( G ( λA )) or inversely ( G ( λ − A )) on λ , in the max-plus sense (see, e.g. , Theo-rem 1.6.18 in [3]). In standard algebra, this corresponds to having arc weights ofthe form, respectively, w (( j, i )) = A ij + λ and w (( j, i )) = A ij − λ , where w (( j, i ))indicates the weight of arc ( j, i ) and A ij ∈ R . Karp and Orlin provided two al-gorithms, running respectively in O ( n ) and O ( nm + n log n ), that solve theNCP on parametric graphs with n nodes and m arcs, whose weights are of type w (( j, i )) = A ij + B ij × λ , with A ij ∈ R and B ij ∈ { , +1 } [17]; a faster solutionof the same problem, with time complexity O ( nm log( n )), was found in [24].Moreover, Levner and Kats solved the NCP when w (( j, i )) = A ij + B ij × λ ,with A ij ∈ R and B ij ∈ {− , , +1 } in strongly polynomial time complexity O ( mn ) [19].We extend these problems to a class of more general parametric precedencegraphs of the form G ( λP ⊕ λ − I ⊕ C ), where P, I and C are three arbitrarysquare matrices of the same dimension in the max-plus algebra. We refer tothe NCP for this class of parametric precedence graphs as Proportional-Inverse-Constant -NCP (PIC-NCP). In standard algebra, the weight of a generic arc( j, i ) in graph G ( λP ⊕ λ − I ⊕ C ) can be expressed as w (( j, i )) = max( P ij + λ, I ij − λ, C ij ), where P ij , I ij , C ij ∈ R ∪ {−∞} . Since the class of parametricgraphs studied in the present paper includes all the above-mentioned ones, weaim to extend previous results on the NCP.The interest in this problem comes from a class of discrete-event dynamicalsystems called P-time event graphs (P-TEGs) [5]. In [26], it has been shownthat, for all d ∈ N , a P-TEG with initially 0 or 1 token per place, charac-terized by four square matrices A , A , B , B , admits consistent d -periodictrajectories of period λ if and only if the precedence graph G ( λB (cid:93) ⊕ λ − ( A ⊕ E ⊗ ) ⊕ ( A ⊕ B (cid:93) )) does not contain circuits with positive weight. The problemof finding the periods of all admissible 1-periodic trajectories has been studiedin [2, 8, 18] but an explicit formula for the admissible periods has not yet beenfound. Moreover, in [25], we proved that a P-TEG is boundedly consistent ( i.e. ,there exists a consistent trajectory for the P-TEG in which the delay of the k -thfiring of every pair of transitions is bounded for all k ) if and only if it admits a1-periodic trajectory. Since in most P-TEG applications bounded consistency2 i max( P ij + λ, C ij ) ⇐⇒ j ij (cid:48) P ij + λ C ij (a) Case P ij , C ij ∈ R , I ij = −∞ . j i max( P ij + λ, I ij − λ, C ij ) ⇐⇒ j ij (cid:48) j (cid:48)(cid:48) P ij + λ C ij I ij − λ (b) Case P ij , I ij , C ij ∈ R .Figure 1: Transformations needed to solve the PIC-NCP using Levner-Kats algorithm. Bothtransformations preserve the maximum weight of all paths from node j to node i , for all valuesof P ij , I ij , C ij , λ . is not only desirable, but necessary, this further motivates our study.We remark that the PIC-NCP can always be formulated as an instance ofthe NCP studied by Levner and Kats in [19]. However, in order to do so, it isnecessary to build an augmented precedence graph by adding n (cid:48) ∈ { , . . . , × m } nodes and m (cid:48) ∈ { , . . . , × m } arcs to G ( λP ⊕ λ − I ⊕ C ), in particular: one nodeand two arcs for every arc ( j, i ) in G ( λP ⊕ λ − I ⊕ C ) for which two elementsamong P ij , I ij and C ij are finite; two nodes and four arcs for every ( j, i ) suchthat P ij , I ij and C ij are all finite, as shown in Figure 1. This additional stepincreases the time complexity of the Levner-Kats algorithm to O (( m + m (cid:48) )( n + n (cid:48) ) ), which leads to a worst-case complexity (attained when n (cid:48) = 2 × m and m = n , i.e. , when all elements of P, I, C are real numbers) of O ( n ).In this paper, we propose a faster algorithm based on techniques from dioid(or idempotent semiring) theory, which solves the PIC-NCP in time complexity O ( n ) and space complexity O ( n ). In this way, we indirectly prove that theclass of linear programs of form (LP1) (or similarly (LP2), see page 13) can besolved with the same complexity. Moreover, our algorithm provides a closedformula for the set of parameters λ that solve the problem. The use of tropicalalgebra to solve linear programming problems is not new in literature, andis motivated by Smale’s 9 th unsolved problem in mathematics [22], which askswhether linear programs admit a strongly polynomial time algorithm [4, 20, 12].The algorithm is based on two different diods, the max-plus algebra and thesemiring of formal languages. The relation between matrices in the max-plusalgebra and elements of a formal language is made explicit by means of multi–precedence graphs , which are multi–directed graphs that generalize the conceptof precedence graphs on multiple matrices. Associating every matrix of a multi–precedence graph with a symbol, and every arc with an element of a matrix,we show how propositions on formal languages can be used to prove algebraicstatements in the tropical semiring. 3he paper is organized as follows. In Section 2, some basic algebraic conceptsfrom dioid theory (in particular, max-plus algebra and the algebra of formallanguages) and weighted directed graph theory are recalled. In Section 3, multi-precedence graphs are presented. Section 4 defines the main problem consideredin the paper and gives its solution using both linear programming and twostrongly polynomial algorithms based on dioid theory techniques, Algorithm 1and Algorithm 2. In Section 5, the correctness of Algorithm 1 is proven. Finally,concluding remarks are stated in Section 6.Notation: the set of positive, respectively non-negative, integers is denotedby N , respectively N . Moreover, R max := R ∪{−∞} and ¯ R max := R max ∪{ + ∞} .
2. Preliminaries
In this section, some basic concepts and results from dioid theory are sum-marized. For more details, the reader is referred to [1, 14] and [13].
A dioid ( D , ⊕ , ⊗ ) is a set D endowed with two operations, ⊕ (addition)and ⊗ (multiplication), which have the following properties: both operationsare associative and have a neutral element indicated, respectively, by (cid:15) (zeroelement) and e (unit element), ⊕ is commutative and idempotent ( ∀ a ∈ D a ⊕ a = a ), ⊗ distributes over ⊕ , and (cid:15) is absorbing for ⊗ ( ∀ a ∈ D a ⊗ (cid:15) = (cid:15) ⊗ a = (cid:15) ).The operation ⊕ induces the natural order relation (cid:22) on D , defined by: ∀ a, b ∈ D a (cid:22) b ⇔ a ⊕ b = b . A dioid is complete if it is closed for infinite sums andif ⊗ distributes over infinite sums; in a complete dioid ( D , ⊕ , ⊗ ), there exists aunique greatest (in the sense of (cid:22) ) element of D , denoted (cid:62) , which is definedas (cid:62) = (cid:76) x ∈ D x . The Kleene star of an element a of a complete dioid, denoted a ∗ , is defined by a ∗ = (cid:76) i ∈ N a i , with a = e and a i +1 = a ⊗ a i . The operator + is defined as a + = (cid:76) i ∈ N a i ; hence a ∗ = e ⊕ a + . As in standard algebra, whenunambiguous, the multiplication will be indicated simply as a ⊗ b = ab .If ( D , ⊕ , ⊗ ) is a dioid, then the operations ⊕ and ⊗ can be extended tomatrices with elements in D : ∀ A, B ∈ D m × n , C ∈ D n × p ( A ⊕ B ) ij = A ij ⊕ B ij , ( A ⊗ C ) ij = n (cid:77) k =1 ( A ik ⊗ C kj ) . Moreover, the multiplication between a scalar and a matrix is defined as: ∀ λ ∈ D , A ∈ D m × n ( λ ⊗ A ) ij = λ ⊗ A ij . If ( D , ⊕ , ⊗ ) is a complete dioid, thenthe set of n × n matrices endowed with ⊕ and ⊗ as defined above is a completedioid, ( D n × n , ⊕ , ⊗ ). Its zero and unit elements, respectively, are the matrices E and E ⊗ , where E ij = (cid:15) ∀ i, j and ( E ⊗ ) ij = e if i = j , ( E ⊗ ) ij = (cid:15) if i (cid:54) = j .Furthermore, A (cid:22) B ⇔ A ij (cid:22) B ij ∀ i, j . We recall the following properties ofthe Kleene star operator ∗ and the operator + .4 roposition 1 (From [13]) . Let D be a complete dioid and a, b ∈ D . TheKleene star operator ∗ and the operator + have the following properties: ( a ⊕ b ) ∗ = ( a ∗ b ) ∗ a ∗ = ( b ∗ a ) ∗ b ∗ a ( ba ) ∗ = ( ab ) ∗ a ( ab ∗ ) ∗ = e ⊕ a ( a ⊕ b ) ∗ ( a + ) ∗ = ( a ∗ ) + = a ∗ . (1)(2)(3)(4) An important example of a complete dioid is the max-plus algebra, ( ¯ R max , ⊕ , ⊗ ), where ⊕ indicates the standard maximum operation, ⊗ indicates the stan-dard addition, (cid:15) = −∞ , e = 0, (cid:62) = + ∞ , and (cid:22) coincides with the standard “lessthan or equal to”. For all λ ∈ R , we indicate by λ − the max-plus multiplicativeinverse, i.e. , λ − ⊗ λ = λ ⊗ λ − = 0; moreover, we define (+ ∞ ) − = −∞ and( −∞ ) − = + ∞ . Note that, since ( ¯ R max , ⊕ , ⊗ ) is a complete dioid, the dioid( ¯ R n × nmax , ⊕ , ⊗ ) is also complete. To conclude this section, we prove the followingtechnical lemma. Lemma 1.
Let A and B be two n × n matrices in ¯ R max . Suppose that B ii = + ∞ for some i ∈ { , . . . , n } . Then ( A ⊗ B ) ii (cid:54) = + ∞ ⇒ A ii = −∞ .Proof. ( AB ) ii = ( A i B i ) ⊕ ( A i B i ) ⊕ . . . ⊕ ( A ii ⊗ + ∞ ) ⊕ . . . ⊕ ( A in B ni ) (cid:54) = + ∞ implies A ii ⊗ + ∞ (cid:54) = + ∞ . From the definition of ⊗ we have A ii ⊗ + ∞ (cid:54) = + ∞⇔ A ii = −∞ . In this paper, it will be convenient to interpret (max,+) addition and mul-tiplication of square matrices respectively as union and concatenation of formallanguages. This will be formally stated in Section 3. A correspondence be-tween (max,+) algebra and formal languages is justified by the fact that formallanguages, endowed with the operations of union and concatenation, form acomplete dioid [9].Let Σ = { a , . . . , a l } be an alphabet of l letters (or symbols ) a , . . . , a l . Theset of all finite sequences of letters (or strings ) from Σ is denoted by Σ ∗ . Asubset of Σ ∗ , L ⊆ Σ ∗ , is a formal language , and its elements s ∈ L are words .Let L , L ⊆ Σ ∗ , L = { s , . . . , s n } , L = { t , . . . , t m } be two languages; then L + L = { s , . . . , s n , t , . . . , t m } indicates the union of the two languages, while L · L = L L = { s t , s t , . . . , s t m , s t , s t , . . . , s t m , . . . , s n t m } indicatesthe language containing the concatenations of all strings of L and L . Let s ∈ Σ ∗ , we will often indicate in the same way the (single string) language s := { s } ⊆ Σ ∗ ; the context will clarify whether we are referring to s as a stringor as a language. Let 2 Σ ∗ indicate the power set of Σ ∗ (the set of subsets of Σ ∗ ).Using the notation above, (2 Σ ∗ , + , · ) forms a complete dioid, with zero elementthe empty language ∅ = {} and unit element the language containing only theempty string e , i.e. , { e } . Note that, in contrast to standard notation, we denotethe empty string by e . 5e denote by | s | the length of the word s ( | e | = 0), and by | s | a i the lengthof s relative to letter a i , i.e. , the number of occurrences of the letter a i in s . Weindicate by s ( i ), 1 ≤ i ≤ | s | , the i -th symbol of s . Definition 1 (Balanced string) . We say that a string s is balanced if | s | a = | s | a = . . . = | s | a l . Moreover, a string s is x ∗ x –balanced if it is balanced and s (1) = s ( | s | ) , x ∗ y –balanced if it is balanced and s (1) (cid:54) = s ( | s | ) . For convenience,we consider the empty string e to be both x ∗ x and x ∗ y –balanced.2.4. Precedence graphs Definition 2 (Precedence graph) . Let A ∈ ¯ R n × nmax . The precedence graph asso-ciated with A is the weighted directed graph G ( A ) = ( N, E, w ) , where- N = { , . . . , n } is the set of nodes,- E ⊆ N × N is the set of arcs, defined such that there is an arc ( j, i ) ∈ E from node j to node i iff A ij (cid:54) = −∞ ,- w : E → R ∪ { + ∞} is a function that associates a weight w (( j, i )) = A ij to every arc ( j, i ) of G ( A ) .When matrix A depends on some real parameters, A = A ( λ , . . . , λ p ) , λ , . . . , λ p ∈ R , we say that G ( A ) is a parametric precedence graph. A path ρ in G ( A ) = ( N, E, w ) is a sequence of nodes ( i , i , . . . , i r +1 ), r ≥ i j to node i j +1 , such that ∀ j = 1 , . . . , r , ( i j , i j +1 ) ∈ E ; wewill use the notation ρ = i → i → . . . → i r +1 . The length of a path ρ , denoted by | ρ | L , is the number of its arcs. Its weight, | ρ | W , is the max-plus product (standard sum) of the weights of its arcs: | ρ | L = r, | ρ | W = r (cid:79) j =1 A i j +1 ,i j . We define the weight of every path of length | ρ | L = 0 to be | ρ | W = 0. A pathis elementary if all its nodes are distinct. A path ρ = i → . . . → i r +1 iscalled circuit if its initial and final nodes coincide, i.e., if i = i r +1 . A circuit ρ = i → . . . → i r +1 is called elementary if the path ˜ ρ = i → . . . → i r iselementary.We recall from [14] that, given A ∈ R n × nmax , r ∈ N , ( A r ) ij is equal to themaximum weight of all paths in G ( A ) from node j to node i of length r . If thereis no such path, then ( A r ) ij = −∞ . We emphasize that, in contrast to [14],although the main focus of this paper will be graphs G ( A ) with A ∈ R n × nmax , itwill be useful to consider, in general, + ∞ as a valid weight of arcs to provesome results contained in Section 5. However, it is trivial to see that the aboveinterpretation for ( A r ) ij can be generalized to matrices A ∈ ¯ R n × nmax . We indicateby mcm( A ) the maximum circuit mean of the precedence graph G ( A ), which6an be computed as mcm( A ) = (cid:76) nk =1 ( tr ( A k )) k , where tr ( M ) is the trace ofmatrix M , i.e. , the max-plus sum of its diagonal elements, and a k represents,again in the max-plus sense, the k -th root of a , i.e. , ( a k ) k = a [1].We indicate by Γ the set of all precedence graphs that do not contain circuitswith positive weight. The following proposition, which is valid, in general, onlyfor matrices with elements in R max , connects max-plus linear inequalities withgraphs. Proposition 2 (From [1, 10] and Proposition 1.6.10 in [3]) . Let A ∈ R n × nmax .Then, the following statements are equivalent:- G ( A ) does not contain any (elementary) circuit with positive weight, i.e., G ( A ) ∈ Γ ,- inequality x (cid:23) A ⊗ x has at least one finite solution x ∈ R n ,- A ∗ does not contain any + ∞ , i.e., A ∗ ∈ R n × nmax . Unlike the previous proposition, the following one holds for the larger classof matrices with elements in ¯ R max . Proposition 3.
Let A ∈ ¯ R n × nmax . Then, the following statements are equivalent: (i) G ( A ) ∈ Γ , (ii) for all i ∈ { , . . . , n } , ( A ∗ ) ii = 0 , (iii) for all i ∈ { , . . . , n } , ( A ∗ ) ii (cid:54) = + ∞ .Moreover, there is a circuit with positive weight in G ( A ) containing node i ifand only if ( A ∗ ) ii = + ∞ .Proof. (i) ⇔ (ii): the proof comes from the following equivalences: there are nocircuits with positive weight in G ( A ) ⇔ ∀ i ∈ { , . . . , n } , k ∈ N ( A k ) ii (cid:22) ⇔ ( A ∗ ) ii = 0 ⊕ A ii ⊕ ( A ) ii ⊕ . . . = 0.(i) ⇒ (iii): obvious from (i) ⇒ (ii).(i) ⇐ (iii): suppose that G ( A ) / ∈ Γ. Then there is a circuit ρ from somenode i of length k such that | ρ | W = ( A k ) ii (cid:31)
0. Let us consider the circuit ρ h , formed by going through ρ h ∈ N times. We have that | ρ h | L = k h and | ρ h | W = ( | ρ | W ) h (cid:31) | ρ | W (in standard notation, | ρ h | W = h × | ρ | W ). Note that,since A k h ii is equal to the greatest weight of all circuits including i of length k h ,( A k h ) ii (cid:23) | ρ h | W . Therefore, ( A ∗ ) ii = 0 ⊕ A ii ⊕ . . . ⊕ ( A k ) ii ⊕ . . . ⊕ ( A k ) ii ⊕ . . . ⊕ ( A k ) ii ⊕ . . . = + ∞ .Regarding the last sentence of the proposition, the sufficiency comes fromthe proof of (i) ⇐ (iii). For the necessity, suppose that ( A ∗ ) ii = + ∞ butthere is no circuit with positive weight from node i . Then, for all k ∈ N ,( A k ) ii (cid:22)
0. Therefore, ( A ∗ ) ii = 0 ⊕ A ii ⊕ ( A ) ii ⊕ . . . = 0, which contradicts thehypothesis. Remark 1.
We emphasize some consequences of Propositions 2 and 3:7 for all A ∈ ¯ R n × nmax , for all i ∈ { , . . . , n } , ( A ∗ ) ii ∈ { , + ∞} ;- since R max is a subset of ¯ R max , Proposition 3 holds for matrices withelements in R max , too;- for all matrices A ∈ ¯ R n × nmax such that A ij = + ∞ for some i, j ∈ { , . . . , n } ,the presence of + ∞ elements outside the main diagonal of A ∗ is not suf-ficient for concluding that G ( A ) / ∈ Γ.The problem of detecting the existence of circuits with positive weight inprecedence graphs can be reduced to the problem of finding the shortest pathfrom a node [6]. The shortest path from a node problem, as well as the computa-tion of the maximum circuit mean, have been well studied in literature; the mostclassical algorithms for their solutions are, respectively, the Bellman-Ford algo-rithm and Karp’s algorithm, both of strongly polynomial complexity O ( n × m )where n is the number of nodes and m is the number of edges [7]. Finally, werecall that, for all A ∈ ¯ R n × nmax such that G ( A ) ∈ Γ, A ∗ can be computed by usingFloyd-Warshall algorithm of strongly polynomial complexity O ( n ) [6]. In thecase G ( A ) / ∈ Γ, the problem of computing A ∗ is NP-hard [6]. Fortunately, thealgorithms that will be presented in Section 4 will never face this issue in prac-tice; nevertheless, considering A ∗ when G ( A ) / ∈ Γ will be useful for theoreticalresults of Subsection 5.2.
3. Multi–precedence graphs
In this section, a new type of directed graph, called multi–precedence graph,is defined. Multi–precedence graphs are a generalization of precedence graphs, inwhich every arc is labeled and each label corresponds to a different matrix. Theirdefinition is similar to the one of max-plus automata [11], with the differencethat in multi–precedence graphs there are no initial and final states. Moreover,max-plus automata are a modelling framework for dynamical systems, whilemulti–precedence graphs are used here as a tool to connect the concepts ofprecedence graphs and formal languages.
Definition 3 (Multi–precedence graph) . Let A , . . . , A l be n × n matrices in ¯ R max . The multi–precedence graph associated with matrices A , . . . , A l is theweighted multi–directed graph G ( A , . . . , A l ) = ( N, Σ , µ, E ) , where- N = { , . . . , n } is the set of nodes,- Σ = { a , . . . , a l } is the alphabet of symbols a , . . . , a l ,- µ : Σ → ¯ R n × nmax is the morphism defined as µ ( z ) = A if z = a ... A l if z = a l , G ( A ) 1 2 3 G ( B )21 3 G ( A, B )2 − − − , a − , a , b − , b − , b , b Figure 2: Precedence graphs G ( A ), G ( B ) and multi–precedence graph G ( A, B ) associated withmatrices A and B of Example 1. - E ⊆ N × N × Σ is the set of labeled arcs, defined such that there is anarc ( j, i, z ) ∈ E from node j to node i labeled z with weight ( µ ( z )) ij iff ( µ ( z )) ij (cid:54) = −∞ .When matrices A , . . . , A l depend on some real parameters, A = A ( λ , . . . , λ p ) ,. . . , A l = A l ( λ , . . . , λ p ) , λ , . . . , λ p ∈ R , we say that G ( A , . . . , A l ) is a para-metric multi–precedence graph. A path in G ( A , . . . , A l ) is a sequence of alternating nodes and labels of theform σ = ( i , z , i , z , . . . , z r , i r +1 ), r ≥
0, with arcs from node i j to node i j +1 labeled by z j , such that ∀ j = 1 , . . . , r ( i j , i j +1 , z j ) ∈ E ; we will use the notation σ = i z −→ i z −→ . . . z r −→ i r +1 , and we say that the path σ is labeled z r z r − · · · z . The definitions of length ofa path | σ | L , weight of a path | σ | W , elementary path and circuit are the same asfor precedence graphs. When not otherwise stated, we will use the conventionto indicate matrices with uppercase letters ( A, B, C, . . . ) and their associatedsymbols in a multi–precedence graph with the corresponding lowercase letters( G ( A, B, C, . . . ) = ( N, Σ , µ, E ) with Σ = { a , b , c , . . . } such that µ ( a ) = A , µ ( b ) = B , µ ( c ) = C, . . . ). Example 1.
Let A = −∞ −∞ −∞ −∞ −∞−∞ −∞ − , B = −∞ − −∞ −∞−∞ − −∞ . The precedence graphs G ( A ) and G ( B ) and the multi–precedence graph G ( A, B )are shown in Figure 2.We can extend the morphism µ to µ : 2 Σ ∗ → ¯ R n × nmax as: µ ( { e } ) = E ⊗ , µ ( { z } ) = µ ( z ) , ( L + L ) = µ ( L ) ⊕ µ ( L ) ,µ ( L L ) = µ ( L ) ⊗ µ ( L )for all z ∈ Σ, L , L ⊆ Σ ∗ . It is trivial to see that the following propertieshold for µ . Let L ⊆ Σ ∗ be a language, then µ ( L ∗ ) = µ ( L ) ∗ . Moreover, let L , L ⊆ Σ ∗ be two languages such that L ⊆ L , then µ ( L ) (cid:22) µ ( L ). If s ∈ Σ ∗ is a string, we will often use the notation µ ( s ) to indicate µ ( { s } ).As in precedence graphs, where elements of the r -th power of matrices can beinterpreted as weights of paths of length r , we can interpret elements of productsof r matrices as weights of paths of length r in multi–precedence graphs. Forinstance, let A and B be n × n matrices in ¯ R max and let us consider the multi–precedence graph G ( A, B ). Then, ( AB ) ij = max k ,k ( A ik + B k k + B k j )is equal to the maximum weight of all paths in the multi–precedence graph G ( A, B ) of the form σ = j b −→ k b −→ k a −→ i for all k , k = 1 , . . . , n . In the same way, the diagonal element ( AB ) ii repre-sents the maximum weight of all circuits from node i of the form σ = i b −→ k b −→ k a −→ i for all k , k = 1 , . . . , n . More generally, we can state the following proposition. Proposition 4.
Let A , . . . , A l be n × n matrices in ¯ R max and G ( A , . . . , A l ) =( N, Σ , µ, E ) the multi–precedence graph associated with them. Then, for eachstring s ∈ Σ ∗ , element i, j of matrix µ ( s ) , ( µ ( s )) ij = ( µ ( s (1)) ⊗ µ ( s (2)) ⊗ . . . ⊗ µ ( s ( | s | ))) ij == max k ,...,k | s |− (cid:0) µ ( s (1)) ik + µ ( s (2)) k k + . . . + µ ( s ( | s | )) k | s |− j (cid:1) , is equal to the maximum weight of all paths σ in G ( A , . . . , A l ) of the form σ = j s ( | s | ) −−−→ k | s |− s ( | s |− −−−−−→ k | s |− s ( | s |− −−−−−→ · · · s (2) −−→ k s (1) −−→ i, for all k , . . . , k | s |− ∈ { , . . . , n } . The following proposition shows that multi–precedence graphs can be usedto study the sign of circuit weights in some precedence graphs.
Proposition 5.
Let A , . . . , A l be n × n matrices in ¯ R max and G ( A , . . . , A l ) =( N, Σ , µ, E ) the multi–precedence graph associated with them. Then G ( A , . . . , A l ) has a circuit with positive weight from node i ∈ N iff the prece-dence graph G ( A ⊕ . . . ⊕ A l ) = ( N, E , w ) has a circuit with positive weightfrom node i ∈ N .Proof. The precedence graph G ( A ⊕ . . . ⊕ A l ) = ( N, E , w ) can be built fromthe multi–precedence graph G ( A , . . . , A l ) = ( N, Σ , µ, E ) as follows:10 E ⊆ N × N is defined such that there is an arc ( j, i ) from node j to node i iff ∃ z ∈ Σ such that ( j, i, z ) ∈ E ,- w : E → R is defined for all ( j, i ) ∈ E as w (( j, i )) = (cid:77) z ∈ Σ µ ij ( z ) . Therefore, if there is a circuit σ = i z −→ k r − z −→ · · · z r − −−−→ k z r −→ i in G ( A , . . . , A l ) from node i ∈ N such that | σ | W >
0, then, by construction,there exists in G ( A ⊕ . . . ⊕ A l ) a circuit ρ = i → k r − → · · · → k → i from node i ∈ N , and its weight is such that | ρ | W ≥ | σ | W >
0. Conversely, ifthere is a circuit with positive weight in precedence graph G ( A ⊕ . . . ⊕ A l ), thenthe same circuit, with the same weight, is present in multi–precedence graph G ( A , . . . , A l ).Similarly to precedence graphs, we indicate with Γ M the set of multi–precedence graphs that do not contain any circuit with positive weight. Example 2.
Let us consider matrices A , B of Example 1. From Proposition 4and AB = −∞ −∞ −∞−∞ −∞ − −∞ , we can conclude, for example, that there is at least a circuit in G ( A, B ) of form σ ( k ) = 2 b −→ k a −→ ,k ∈ { , , } , and also that the maximum weight for a circuit of this form ismax k | σ ( k ) | W = 0. In particular, the maximum is attained by σ (1) = 2 b −→ a −→
2. In the same way, since AB = −∞ −∞ −∞ −∞− −∞ −∞ , then there exists a circuit in G ( A, B ) of the form σ ( k , k ) = 2 b −→ k b −→ k a −→ ,k , k ∈ { , , } and the maximum weight for a circuit of this form ismax k ,k | σ ( k , k ) | W = 1. In particular, the maximum is attained by σ (3 ,
1) =2 b −→ b −→ a −→
2. Because of the presence of a circuit with positive weight fromnode 2 in G ( A, B ), from Proposition 5 we can conclude that there exists a circuitwith positive weight from node 2 in G ( A ⊕ B ), i.e. , (( A ⊕ B ) ∗ ) = + ∞ .11n the following, we state an interesting property of the Kleene star opera-tor, when applied to a matrix that can be factored as a product of two squarematrices. The proposition will also show how the interpretation of matrix mul-tiplications in terms of weight of paths in multi–precedence graphs can be usedto prove algebraic statements in the max-plus algebra. Proposition 6.
Let
A, B ∈ ¯ R n × nmax . Then ∃ i such that (( A ⊗ B ) ∗ ) ii = + ∞ ifand only if ∃ k such that (( B ⊗ A ) ∗ ) kk = + ∞ .Proof. Let us define the multi–precedence graph G ( A, B ) = ( N, { a , b } , µ, E ).Suppose that G ( A ⊗ B ) / ∈ Γ; then there exists a node i ∈ N such that (( A ⊗ B ) ∗ ) ii = ( µ ( ab ) ∗ ) ii = + ∞ . From Propositions 4 and 5, this implies that thereis a circuit with positive weight σ in G ( A, B ) of the form σ = i b −→ k a −→ i for some k ∈ N . Let us build another circuit ˜ σ as˜ σ = k a −→ i b −→ k. Since the edges in σ and ˜ σ are the same, then | ˜ σ | W = | σ | W >
0; thus( µ ( ba ) ∗ ) kk = (( B ⊗ A ) ∗ ) kk = + ∞ , which also implies that G ( B ⊗ A ) / ∈ Γ.
4. Problem formulation
Given a parametric precedence graph G ( A ), A = A ( λ , . . . , λ p ) ∈ R n × nmax ,the Non-positive Circuit weight Problem (NCP) consists in finding the valuesfor λ , . . . , λ p ∈ R such that G ( A ) ∈ Γ. The solution of this problem is alreadyknown when A depends proportionally ( A ( λ ) = λA ) or inversely ( A ( λ ) = λ − A )on one single parameter, and is recalled as follows. Proposition 7 (From Theorem 1.6.18 in [3]) . The precedence graph G ( λA ) belongs to Γ iff λ (cid:22) (mcm( A )) − . Similarly, the precedence graph G ( λ − A ) belongs to Γ iff λ (cid:23) mcm( A ) . In this paper, we are interested in solving the NCP on a class of moregeneral parametric precedence graphs. Let
P, I, C be three arbitrary n × n matrices with elements in R max . Let G ( λP ⊕ λ − I ⊕ C ) be a parametricprecedence graph depending on the only parameter λ ∈ R . The weights ofthe arcs in this graph can depend proportionally ( λP ), inversely ( λ − I ) andconstantly ( C ) with respect to λ . For this reason, we refer to the NCP on thisclass of parametric precedence graphs as Proportional-Inverse-Constant -NCP(PIC-NCP). From Proposition 5, the problem can be equivalently stated on theparametric multi-precedence graph G ( λP, λ − I, C ). We indicate by Λ (
P, I, C )the set of λ s that solve the PIC-NCP on graph G ( λP ⊕ λ − I ⊕ C ):Λ ( P, I, C ) := { λ ∈ R | G ( λP ⊕ λ − I ⊕ C ) ∈ Γ } = { λ ∈ R | G ( λP, λ − I, C ) ∈ Γ M } . .1. Solution using linear programming In this section, we show how to use linear programming in standard algebrato solve the PIC-NCP.
Proposition 8.
The existence of a solution λ ∈ R of the PIC-NCP can bechecked in standard algebra using linear programming.Proof. From Proposition 2, G ( λP ⊕ λ − I ⊕ C ) ∈ Γ for some λ ∈ R if and onlyif there exists a vector [ x (cid:124) , λ ] (cid:124) ∈ R n +1 such that x (cid:23) ( λP ⊕ λ − I ⊕ C ) ⊗ x. (5)The i -th inequality can be written in standard algebra as x i ≥ max j =1 ,...,n ( λ + P ij + x j , − λ + I ij + x j , C ij + x j ) , which is equivalent to the following linear system x i ≥ λ + P ij + x j ∀ j = 1 , . . . , nx i ≥ − λ + I ij + x j ∀ j = 1 , . . . , nx i ≥ C ij + x j ∀ j = 1 , . . . , n The system above, written for all i , forms a system of m ≤ n linear inequalitiesin n +1 variables x , . . . , x n , λ , where m is the number of edges in G ( λP, λ − I, C ).Indeed, when an element of the matrices P , I or C is −∞ , the correspondinginequality is automatically satisfied, as the right hand side becomes −∞ .An important observation that comes from the latter proposition is that thesolution set of Inequality (5) is convex in [ x (cid:124) , λ ] (cid:124) . Since the projection of aconvex set is convex, the consequence is that the set of λ s that solves the PIC-NCP is an interval Λ ( P, I, C ) = [ λ min , λ max ] ∩ R , where λ min ∈ ¯ R max is theoptimal value of the linear programmin λ s.t. x i ≥ λ + P ij + x j ∀ i, j = 1 , . . . , nx i ≥ − λ + I ij + x j ∀ i, j = 1 , . . . , nx i ≥ C ij + x j ∀ i, j = 1 , . . . , n (LP1)and, similarly, λ max ∈ ¯ R max is the optimal value of the linear programmax λ s.t. x i ≥ λ + P ij + x j ∀ i, j = 1 , . . . , nx i ≥ − λ + I ij + x j ∀ i, j = 1 , . . . , nx i ≥ C ij + x j ∀ i, j = 1 , . . . , n (LP2)The consequence is that the PIC-NCP can be solved by solving problems (LP1)and (LP2). Observe that Λ ( P, I, C ) coincides with [ λ min , λ max ], unless λ min or λ max are not finite, in which case Λ ( P, I, C ) is an unbounded interval.13 .2. Solution using dioid theory techniques
We recall that it is still an open problem to find an algorithm that solveslinear programs in strongly polynomial time. Our aim is to derive a closedformula for λ min and λ max that can be computed in strongly polynomial time, i.e. , in time complexity that does not depend on the size of parameters P ij , I ij and C ij , for all i, j . First of all, let us observe the following fact. Proposition 9.
Let ρ ∈ R be an arbitrary constant. Then, Λ (cid:0) P ⊕ ρ − E ⊗ , I, C (cid:1) = Λ ( P, I, C ) ∩ ] − ∞ , ρ ] , and, similarly, Λ (
P, I ⊕ ρE ⊗ , C ) = Λ ( P, I, C ) ∩ [ ρ, + ∞ [ . Proof.
Every λ ≤ ρ such that G ( λP ⊕ λ − I ⊕ C ) ∈ Γ must satisfy, for some x ∈ R n , Inequality (5) and ρ (cid:23) λ, ⇔ x (cid:23) λρ − E ⊗ ⊗ x. From the definition of ⊕ , the two inequalities can be merged into x (cid:23) ( λP ⊕ λ − I ⊕ C ) ⊗ x ⊕ λρ − E ⊗ ⊗ x = ( λ ( P ⊕ ρ − E ⊗ ) ⊕ λ − I ⊕ C ) ⊗ x. The first statement of the proposition follows from Proposition 2. The secondstatement can be proven similarly.Therefore, the interval of values that solve the PIC-NCP can be obtained,for all ρ ∈ R , asΛ ( P, I, C ) = Λ (cid:0) P ⊕ ρ − E ⊗ , I, C (cid:1) ∪ Λ (
P, I ⊕ ρE ⊗ , C ) == (cid:16) [ λ ≤ ρmin , λ ≤ ρmax ] ∩ R (cid:17) ∪ (cid:16) [ λ ≥ ρmin , λ ≥ ρmax ] ∩ R (cid:17) , (6)where [ λ ≤ ρmin , λ ≤ ρmax ] := [ λ min , λ max ] ∩ [ −∞ , ρ ] , [ λ ≥ ρmin , λ ≥ ρmax ] := [ λ min , λ max ] ∩ [ ρ, + ∞ ] . Hence, to solve the PIC-NCP, we propose two algorithms of strongly poly-nomial complexity, Algorithms 1 and 2, which compute, respectively, intervalsΛ (cid:0) P ⊕ ρ − E ⊗ , I, C (cid:1) and Λ ( P, I ⊕ ρE ⊗ , C ). In line 8 of both the algorithms, (cid:98)·(cid:99) indicates the floor function. Theorem 2.
Given a constant ρ ∈ R , Algorithm 1 solves the PIC-NCP forgraph G ( λ ( P ⊕ ρ − E ⊗ ) ⊕ λ − I ⊕ C ) , and Algorithm 2 solves the PIC-NCP forgraph G ( λP ⊕ λ − ( I ⊕ ρE ⊕ ) ⊕ C ) . lgorithm 1: Find all λ ≤ ρ s.t. G ( λP ⊕ λ − I ⊕ C ) ∈ Γ Input:
P, I, C ∈ R n × nmax , ρ ∈ R Output: Λ( P ⊕ ρ − E ⊗ , I, C ) if G ( C ) / ∈ Γ then return ∅ else P ← P ⊕ ρ − E ⊗ P ← C ∗ P C ∗ // denoted µ ( P ) in Subsection 5.2 I ← C ∗ IC ∗ // denoted µ ( I ) in Subsection 5.2 S ← E ⊗ // initialize µ ( S ( P , I , for k = 1 to (cid:4) n (cid:5) do S ← P S I ⊕ IS P ⊕ E ⊗ // compute µ ( S ( P , I , k )) end if G ( S ) / ∈ Γ then return ∅ else λ ≤ ρmin ← mcm( IS ∗ ) λ ≤ ρmax ← (mcm( P S ∗ )) − if λ ≤ ρmin > λ ≤ ρmax then return ∅ else return [ λ ≤ ρmin , λ ≤ ρmax ] ∩ R end end end The proof will be given in the next section. In the reminder of this section,we will suppose that the algorithms are correct. Therefore, to solve the PIC-NCP, we can run both algorithms with any choice of ρ ∈ R , and then useEquation (6). We observe that, given cubic complexity for square matrix max-plus multiplication, the time complexity of the algorithms is O ( n ), since theyare dominated by the “for” loop. Moreover, their space complexity is O ( n ) as,at each step of the algorithms, 3 matrices of size n × n must be stored.In the following, we show that, in some cases, an adequate choice for theconstant ρ allows to solve the PIC-NCP by using only one of the algorithms.Observe that Inequality (5) can be written as the system x (cid:23) λP ⊗ xx (cid:23) λ − I ⊗ xx (cid:23) C ⊗ x. Since, from Proposition 7, the first inequality admits a solution iff λ (cid:22) (mcm( P )) − and the second one iff λ (cid:23) mcm( I ), a necessary conditionfor λ to be feasible is that λ ∈ [mcm( I ) , (mcm( P )) − ]. Note that, in general[mcm( I ) , (mcm( P )) − ] ∩ R does not coincide with the solution set of the PIC-NCP because the three inequalities above must be satisfied by the same vector x .15 lgorithm 2: Find all λ ≥ ρ s.t. G ( λP ⊕ λ − I ⊕ C ) ∈ Γ Input:
P, I, C ∈ R n × nmax , ρ ∈ R Output:
Λ (
P, I ⊕ ρE ⊗ , C ) if G ( C ) / ∈ Γ then return ∅ else I ← I ⊕ ρE ⊗ P ← C ∗ P C ∗ I ← C ∗ IC ∗ S ← E ⊗ for k = 1 to (cid:4) n (cid:5) do S ← P S I ⊕ IS P ⊕ E ⊗ end if G ( S ) / ∈ Γ then return ∅ else λ ≥ ρmin ← mcm( IS ∗ ) λ ≥ ρmax ← (mcm( P S ∗ )) − if λ ≥ ρmin > λ ≥ ρmax then return ∅ else return [ λ ≥ ρmin , λ ≥ ρmax ] ∩ R end end end However, if (mcm( P )) − ∈ R (mcm( I ) ∈ R ), then by choosing ρ = (mcm( P )) − ( ρ = mcm( I )), Algorithm 1 (Algorithm 2) directly computes the solution set ofthe PIC-NCP, since[ λ min , λ max ] ∩ [ −∞ , (mcm( P )) − ] = [ λ min , λ max ]([ λ min , λ max ] ∩ [mcm( I ) , + ∞ ] = [ λ min , λ max ]) . Only in the case both the maximum circuit means are not real ((mcm( P )) − =+ ∞ and mcm( I ) = −∞ ), ρ can be chosen randomly and both Algorithm 1 andAlgorithm 2 must be used to compute Λ ( P, I, C ).As follows, we give a little insight into Algorithm 1. The main idea behindthe algorithm is to build a sequence of matrices M ( k ) min and M ( k ) max , such that thesequence of intervals I ( k ) := [mcm( M ( k ) min ) , (mcm( M ( k ) max )) − ]approximates better and better [ λ ≤ ρmin , λ ≤ ρmax ] with increasing values of k ∈ N .A first approximation of [ λ ≤ ρmin , λ ≤ ρmax ] is obtained by setting M (0) min := C ∗ IC ∗ M (0) max := C ∗ ( P ⊕ ρ − E ⊗ ) C ∗ (lines 5-6) . Indeed, with this choice we have[ λ ≤ ρmin , λ ≤ ρmax ] ⊆ I (0) ⊆ [mcm( I ) , (mcm( P ⊕ ρ − E ⊗ )) − ] . In order to get tighter approximations, it is necessary to introduce anothersequence of matrices: let S ( k ) denote the matrix obtained after k ∈ N iterationsof the “for” loop of lines 8-10, with S (0) = E ⊗ . By choosing, for all k ∈ N , M ( k ) min := M (0) min ( S ( k ) ) ∗ and M ( k ) max := M (0) max ( S ( k ) ) ∗ , we have [ λ ≤ ρmin , λ ≤ ρmax ] ⊆ I ( k +1) ⊆ I ( k ) . Moreover, as it will be proved in the next section, the sequenceof intervals I ( k ) converges to [ λ ≤ ρmin , λ ≤ ρmax ] after at most k = (cid:4) n (cid:5) iterations. Remark 2.
In case P , I or C is E , the problem reduces to a subclass of thePIC-NCP. Clearly, if Algorithms 1 and 2 solve the PIC-NCP, then they solvethese problems, too. Moreover, in these cases, the algorithms can be simplified.In particular, after some easy but tedious computations, one can prove that:- if P = E , the complexity of the algorithms reduces to O ( n ), since λ ≤ ρmin = mcm( C ∗ I ( ρ − I ⊕ C ) ∗ ) λ ≤ ρmax = (mcm( ρ − ( ρ − I ⊕ C ) ∗ )) − λ ≥ ρmin = mcm( C ∗ ( I ⊕ ρE ⊗ )) λ ≥ ρmax = + ∞ ;- if I = E , the complexity of the algorithms reduces to O ( n ), since λ ≤ ρmin = −∞ λ ≤ ρmax = (mcm( C ∗ ( P ⊕ ρ − E ⊗ ))) − λ ≥ ρmin = mcm( ρ ( ρP ⊕ C ) ∗ ) λ ≥ ρmax = (mcm( C ∗ P ( ρP ⊕ C ) ∗ )) − ;- if C = E , lines 1, 5 and 6 of the algorithms are no longer needed, but thecomplexity of the algorithms remains the same.Observe that, as Levner-Kats algorithm can be used to solve the genericPIC-NCP at the cost of increasing its worst-time complexity, the two algorithmsfrom [17] and the one from [24] can be used to solve the PIC-NCP when P = E or I = E . However, nodes and arcs must be added to the original graph, asin Figure 1(a). This increases the worst-case complexity of the algorithms,respectively, to O ( n ), O ( n log n ) and O ( n log n ). Therefore, our algorithmssolve also these subclasses of the PIC-NCP faster than traditional ones, in theworst-case. Example 3.
Let P = −∞ −∞ −∞−∞ −∞ −∞−∞ −∞ − , I = −∞ −∞−∞ −∞ . −∞ −∞ , C = −∞ − −∞ −∞ −∞ . −∞ . These matrices correspond, respectively, to matrices B (cid:93) and A introduced in [23]. − λ, i − λ, i − λ, i − λ, i − λ, p − , c , c . − λ, i , c . , c Figure 3: Parametric multi–precedence graph G ( λP, λ − ( I ⊕ E ⊗ ) , C ) from Example 3. The aim is to find all the values of λ ≥ ρ = 0 such that the parametric prece-dence graph G ( λP ⊕ λ − I ⊕ C ) does not contain circuits with positive weight.From Propositions 5 and 9, we can do so by studying the parametric multi–precedence graph G ( λP, λ − ( I ⊕ E ⊗ ) , C ) = ( N, { p , i , c } , µ, E ), which is depictedin Figure 3, where µ ( p ) = λP , µ ( i ) = λ − ( I ⊕ E ⊗ ) and µ ( c ) = C . The interval[ λ ≥ min , λ ≥ max ] = { λ ∈ R | G ( λP, λ − ( I ⊕ E ⊗ ) , C ) ∈ Γ M } can be obtained by usingAlgorithm 2 with ρ = 0. We get λ ≥ min = mcm( ˜ IS ∗ ) λ ≥ max = (mcm( ˜ P S ∗ )) − , where˜ I = C ∗ ( I ⊕ E ⊗ ) C ∗ = . . − . . . . . . . , ˜ P = C ∗ P C ∗ = −∞ −∞ −∞−∞ −∞ −∞ − − ,S ∗ = ( ˜ P ˜ I ⊕ ˜ I ˜ P ⊕ E ⊗ ) ∗ = − . − . . − . . . ;hence λ ≥ min = 3 . λ ≥ max = 4. From the convexity of the solution set of Inequal-ity (5), since λ ≥ min (cid:54) = 0, we can also conclude that Λ ( P, I, C ) = [ λ ≥ min , λ ≥ max ] =[3 . ,
5. Correctness of the algorithms
In this section, we prove the part of Theorem 2 pertaining with Algorithm 1.The proof of the second part of the theorem is totally analogous. The proofis rather technical, and is based on the connection between formal languagesand multi–precedence graphs. The propositions are divided in propositions onformal languages (Subsection 5.1) and propositions on multi–precedence graphs(Subsection 5.2). 18 .1. Technical propositions on formal languages
Proposition 10.
Let
Σ = { a , b } . Every binary string s ∈ Σ ∗ such that | s | a ≥| s | b can be written as s = t a n t a n · · · a n r − t r , (7) where r ∈ N , n , . . . , n r − ∈ N and t , . . . , t r ∈ Σ ∗ are balanced binary strings.Proof. Let s be a binary string and | s | a − | s | b = m ≥
0. We will prove theproposition by induction. For m = 0, defining t = s , n = 0, r = 1 weobtain (7).Suppose that the proposition holds for all words such that | s | a − | s | b = m ,let us prove that it holds for all words such that | s | a − | s | b = m + 1. Since | s | a −| s | b = m +1, there must be a set H ⊆ N such that ∀ h ∈ H , s = s (1) · · · s ( h )and s = s ( h + 1) · · · s ( | s | ) satisfy | s | a − | s | b = 1 , | s | a − | s | b = m. Let h min = min h H . Then s ( h min ) = a , because if s ( h min ) = b then | s (1) · · · s ( h min − | a − | s (1) · · · s ( h min − | b = 2which implies that ∃ h < h min such that h ∈ H . Then, defining t = s (1) · · · s ( h min − s = t a s ; since | s | a −| s | b = m , the proposition is proven from the induction hypothesis. Lemma 3.
Every x ∗ x –balanced binary string of positive length can be built byconcatenating two x ∗ y –balanced binary strings of positive length.Proof. Let Σ = { a , b } be a binary alphabet. Let us define a function g : Σ →{− , +1 } as g ( z ) = (cid:40) +1 if z = a − z = b , and function h s : { , . . . , | s |} → Z , associated with a string s ∈ Σ ∗ , as h s ( i ) = i (cid:88) j =1 g ( s ( j )) . Intuitively, h s counts up or down by 1 if its argument is +1 or −
1. In Figure 4, h s is plotted for a given string s . It is clear that a binary string s ∈ Σ ∗ isbalanced iff h s ( | s | ) = 0. Let s be an x ∗ x –balanced binary string such that s (1) = s ( | s | ) = a , the case in which s (1) = s ( | s | ) = b is analogous. Then h s (1) = +1 , h s ( | s | −
1) = − , (8)and this implies that ∃ i ∈ { , . . . , | s | − } such that h s ( i −
1) = +1 h s ( i ) = 0 h s ( i + 1) = − . (9)19 h s ( i ) s = a a b a b b a b b a b a t t -1012 Figure 4: Plot of h s associated with an x ∗ x –balanced string s = a bab ab aba . The red linedivides the string s in two x ∗ y –balanced substrings t = a bab ab and t = baba . Indeed, since ∀ i ∈ { , . . . , | s | − } , | h s ( i + 1) − h s ( i ) | = 1, there must be an i thatsatisfies (9) in order to change the sign of h s from positive (in h s (1)) to negative(in h s ( | s | − t = s (1) . . . s ( i ) and t = s ( i + 1) . . . s ( | s | ).Both t and t are balanced because h t ( | t | ) = 0 and h t ( | t | ) = 0; moreover t (1) = a (cid:54) = b = t ( | t | ) and t (1) = b (cid:54) = a = t ( | t | ). Definition 4.
Given an alphabet Σ and two languages L , L ⊆ Σ ∗ , we definethe sequence of languages S : 2 Σ ∗ × Σ ∗ × N → Σ ∗ recursively as S ( L , L ,
0) = { e } , S ( L , L , k ) = L S ( L , L , k − L + L S ( L , L , k − L + e ∀ k ∈ N . Theorem 4.
Given
Σ = { a , b } , k ∈ N , language S ( { a } , { b } , k ) contains all x ∗ y –balanced binary strings in Σ ∗ of length less than or equal to k .Proof. We will use the notation S k in place of S ( { a } , { b } , k ) for all k ∈ N .The theorem will be proven by induction. For k = 0 the proof is trivial asthe empty string, by definition, is x ∗ y –balanced. Suppose that S k containsall x ∗ y –balanced binary strings of length ≤ k , we want to prove that S k +1 contains all x ∗ y –balanced binary strings of length ≤ k + 1).We can write S k +1 = a S k b + b S k a + e == a ( a S k − b + b S k − a + e ) b + b ( a S k − b + b S k − a + e ) a + e == a (( a S k − b + b S k − a ) + a S k − b + b S k − a + e ) b ++ b (( a S k − b + b S k − a ) + a S k − b + b S k − a + e ) a + e == a ( L + L + e ) b + b ( L + L + e ) a + e , (10)where we used the substitution L := a S k − b + b S k − a . Since every x ∗ y –balanced string of length ≤ k + 1) either starts with a and ends with b orstarts with b and ends with a , if we prove that S k = L + L + e contains allbalanced strings of length ≤ k (without any condition on the first and lastletters) then the proof of the theorem is completed.20ince L = S k \ { e } , then L contains all x ∗ y –balanced strings of positivelength ≤ k . From Lemma 3, every x ∗ x –balanced string of positive lengthcan be built by concatenating two x ∗ y –balanced strings of positive length;therefore L + e = LL + e contains all x ∗ x –balanced strings of length ≤ k .Then, L + L + e contains all balanced strings of length ≤ k .In the proof, we also showed that S ( { a } , { b } , k ) contains all balanced stringsof Σ of length ≤ k . Since S ( { a } , { b } , k ) ⊆ S ( { a } , { b } , k ) ∗ , this is also validfor S ( { a } , { b } , k ) ∗ . Moreover, since the length of every balanced binary stringis an even number, then S ( { a } , { b } , (cid:4) k (cid:5) ) contains all the x ∗ y –balanced stringsof length ≤ k and the following statement holds. Corollary 1.
Given
Σ = { a , b } , k ∈ N , language S ( { a } , { b } , (cid:4) k (cid:5) ) ∗ containsall balanced binary strings in Σ ∗ of length less than or equal to k . Remark 3.
As it will become apparent in the next section, the usefulness ofsequence S ( · , · , k ) derives entirely from Theorem 4. This means that the onlyproperty that we need is that it contains all x ∗ y -balanced words of length 2 k .However, note that the sequence is not the minimal one with respect to thisproperty: in other words, it does not coincide with the language of all x ∗ y -balanced words of length 2 k , but it contains it. A formula that describes theminimal language with this property is not known to the authors, and using itinstead of sequence S ( · , · , k ) would probably result in faster algorithms than theones presented in this paper, since the number of operations required to buildthe language would be lower. In this section, we conclude the proof of the correctness of Algorithm 1. Werecall that, from Proposition 9, we only need to prove that the set of all λ ssuch that G ( λ ( P ⊕ ρ − E ⊗ ) , λ − I, C ) ∈ Γ can be found using Algorithm 1. Weemphasize that, since ρ ∈ R , then the diagonal elements of matrix P ⊕ ρ − E ⊗ are different from −∞ . This property will be used extensively in the nextpropositions. For sake of simplicity, in this section matrix P ⊕ ρ − E ⊗ willbe simply indicated as P ( i.e. , we will assume that, for all i ∈ { , . . . , n } , P ii (cid:54) = −∞ ). Lemma 5.
Let G ( P, I ) = ( N, { p , i } , µ, E ) and let L ⊆ { p , i } ∗ be a language.Then G ( µ ( p + L )) ∈ Γ if and only if G ( µ ( p L ∗ )) ∈ Γ .Proof. “ ⇒ ”: Since ( p + L ) ∗ contains all the strings made by concatenating p and the strings of L , then it contains also ( p L ∗ ) ∗ ; therefore, from the propertiesof µ , ∀ i ∈ { , . . . , n } ,+ ∞ (cid:31) ( µ ( p + L ) ∗ ) ii = µ (( p + L ) ∗ ) ii (cid:23) µ (( p L ∗ ) ∗ ) ii = ( µ ( p L ∗ ) ∗ ) ii . Therefore, from Proposition 3, G ( µ ( p L ∗ )) ∈ Γ.“ ⇐ ”: Using Equation (3), we have( µ ( p L ∗ )) ∗ = E ⊗ ⊕ µ ( p )( µ ( p + L )) ∗ . (11)21e then proceed by contradiction and assume that ∃ i such that ( µ ( p + L ) ∗ ) ii =+ ∞ . Since, from hypothesis, ( µ ( p L ∗ ) ∗ ) ii (cid:54) = + ∞ , from Equation (11), it mustbe ( µ ( p )( µ ( p + L )) ∗ ) ii (cid:54) = + ∞ . Then, from Lemma 1 µ ( p ) ii = P ii = −∞ , whichis excluded by hypothesis.In the proof of the previous lemma, we used the fact that P was short handfor P ⊕ ρ − E ⊗ , which implied ∀ i P ii (cid:54) = −∞ ; this was instrumental for the proof.In the next proof, however, we can not proceed in the same way because we donot make any assumptions on the diagonal elements of matrix I ; instead, we useproperties of the language containing all balanced strings of a bounded lengthproposed in Subsection 5.1. Lemma 6.
Let G ( P, I ) = ( N, { p , i } , µ, E ) and S = S ( { p } , { i } , (cid:4) n (cid:5) ) . Supposethat G ( µ ( p S ∗ )) ∈ Γ . Then G ( µ ( i + S )) ∈ Γ if and only if G ( µ ( i S ∗ )) ∈ Γ .Proof. “ ⇒ ”: the proof is analogous to the one of Lemma 5.“ ⇐ ”: we will assume throughout the proof that n >
1; in the case n = 1 theproof is trivial. Let L := S \ { e } . In the following, we will prove that conditions G ( µ ( p L ∗ )) ∈ Γ and G ( µ ( i L ∗ )) ∈ Γ imply G ( µ ( i + L )) ∈ Γ. Note that this issufficient to prove the lemma; indeed, since L ∗ = S ∗ , then µ ( p L ∗ ) ∗ = µ ( p S ∗ ) ∗ , µ ( i L ∗ ) ∗ = µ ( i S ∗ ) ∗ and µ ( i + L ) ∗ = µ ( i + S ) ∗ , and this, from Proposition 3,implies that G ( µ ( p L ∗ )) ∈ Γ ⇔ G ( µ ( p S ∗ )) ∈ Γ, G ( µ ( i L ∗ )) ∈ Γ ⇔ G ( µ ( i S ∗ )) ∈ Γand G ( µ ( i + L )) ∈ Γ ⇔ G ( µ ( i + S )) ∈ Γ.From Equation (3), we can write µ ( i L ∗ ) ∗ = E ⊗ ⊕ µ ( i ) µ ( i + L ) ∗ . (12)We then proceed by contradiction and assume that ∃ i such that ( µ ( i + L ) ∗ ) ii =+ ∞ . Since, from hypothesis, ( µ ( i L ∗ ) ∗ ) ii (cid:54) = + ∞ , from Equation (12), it must be( µ ( i )( µ ( i + L )) ∗ ) ii (cid:54) = + ∞ . Then, from Lemma 1, µ ( i ) ii = I ii = −∞ , which is not excluded by hypothesis. Since µ ( i + L ) ∗ = E ⊗ ⊕ µ ( i + L ) + , then ( µ ( i + L ) ∗ ) ii =+ ∞ iff + ∞ = ( µ ( i + L ) + ) ii = ( µ ( i + L ) µ ( i + L ) ∗ ) ii == ( µ ( i ) µ ( i + L ) ∗ ) ii ⊕ ( µ ( L ) µ ( i + L ) ∗ ) ii . Let us show that neither terms of the sum can be + ∞ . Since ( µ ( i L ∗ ) ∗ ) ii (cid:54) = + ∞ ,from Equation (12), ( µ ( i ) µ ( i + L ) ∗ ) ii (cid:54) = + ∞ . Hence, it remains to show that( µ ( L ) µ ( i + L ) ∗ ) ii (cid:54) = + ∞ . Let us assume the contrary and let s , . . . , s h be allthe words composing L : L = s + · · · + s h . (Note that L (cid:54) = ∅ , since n > ∞ = ( µ ( L ) µ ( i + L ) ∗ ) ii = ( µ ( s ) µ ( i + L ) ∗ ) ii ⊕ . . . ⊕ ( µ ( s h ) µ ( i + L ) ∗ ) ii , which implies that ∃ j ∈ { , . . . , h } such that ( µ ( s j ) µ ( i + L ) ∗ ) ii = + ∞ . In thefollowing, we show that the latter statement is false. To do so, we consider ageneric s j , and we prove, by contradiction, that ( µ ( s j ) µ ( i + L ) ∗ ) ii = 0. Werecall that, from construction, every word in L is x ∗ y -balanced and differentfrom e , so in every word the first and last letter must be different. Hence, either22 j is such that s j (1) = p and s j ( | s j | ) = i , or s j (1) = i and s j ( | s j | ) = p . Weanalyze these two cases separately. Case 1 : let s j be such that s j = p ¯ s j i , with ¯ s j balanced and¯ s j = s j (2) · · · s j ( | s j | − ∈ { p , i } ∗ if | s j | >
2, otherwise ¯ s j = e . We have,+ ∞ = ( µ ( s j ) µ ( i + L ) ∗ ) ii = ( µ ( p ¯ s j ) µ ( i ) µ ( i + L ) ∗ ) ii , hence either matrix µ ( p ¯ s j ) or matrix µ ( i ) µ ( i + L ) ∗ contains a + ∞ (not necessarilyon the diagonal), because otherwise no + ∞ would be contained in their prod-uct ( R n × nmax is closed under finite multiplications). Since µ ( p ¯ s j ) = µ ( p ) µ (¯ s j ) is aproduct of a finite number of matrices in R max , it cannot contain a + ∞ . Then, µ ( i ) µ ( i + L ) ∗ must contain a + ∞ , and Equation (12) implies that µ ( i L ∗ ) ∗ con-tains a + ∞ . We emphasize that hypothesis G ( µ ( i L ∗ )) ∈ Γ does not exclude thispossibility; indeed, if µ ( i L ∗ ) / ∈ R n × nmax , Proposition 2 cannot be used, and matrix µ ( i L ∗ ) ∗ could contain a + ∞ (outside the diagonal) even if G ( µ ( i L ∗ )) ∈ Γ (seeRemark 1). However, since G ( p L ∗ ) ∈ Γ, then, from Lemma 5, also G ( p + L ) ∈ Γ,and + ∞ (cid:31) ( µ ( L + p ) ∗ ) ii (cid:23) ( µ ( L ) ∗ ) ii ; therefore, since µ ( L ) ∈ R n × nmax , then µ ( L ) ∗ ∈ R n × nmax , which implies that µ ( i L ∗ ) = µ ( i ) µ ( L ) ∗ ∈ R n × nmax . Now we canapply Proposition 2: if µ ( i L ∗ ) ∗ contains a + ∞ , then G ( µ ( i L ∗ )) / ∈ Γ, which is ex-cluded by hypothesis. This implies that for all i , for all s j of the form s j = p ¯ s j i ,( µ ( s j ) µ ( i + L ) ∗ ) ii (cid:54) = + ∞ . Case 2 : let s j be such that s j = i ¯ s j p , with ¯ s j balanced and¯ s j = s j (2) · · · s j ( | s j | − ∈ { p , i } ∗ if | s j | >
2, otherwise ¯ s j = e . We have+ ∞ = ( µ ( s j ) µ ( i + L ) ∗ ) ii = [since 0 ⊕ + ∞ = + ∞ ] == ( µ ( e ) ⊕ µ ( s j ) µ ( i + L ) ∗ ) ii = [since L = L + s j ] == ( µ ( e ) ⊕ µ ( s j ) µ (( i + L ) + s j ) ∗ ) ii = [from (3)] == ( µ ( s j ( i + L ) ∗ ) ∗ ) ii = [from (1)] = ( µ ( s j ( L ∗ i ) ∗ L ∗ ) ∗ ) ii = [from (2)] == ( µ ( s j L ∗ ( i L ∗ ) ∗ ) ∗ ) ii = ( µ ( i ¯ s j p L ∗ ( i L ∗ ) ∗ ) ∗ ) ii = (( µ ( i ) µ (¯ s j p L ∗ ( i L ∗ ) ∗ )) ∗ ) ii . Using Proposition 6, there exists a k such that+ ∞ = (( µ ( i ) µ (¯ s j p L ∗ ( i L ∗ ) ∗ )) ∗ ) ii = (( µ (¯ s j p L ∗ ( i L ∗ ) ∗ ) µ ( i )) ∗ ) kk == ( µ (¯ s j p L ∗ ( i L ∗ ) ∗ i ) ∗ ) kk = [from (2)] == ( µ (¯ s j p L ∗ i ( L ∗ i ) ∗ ) ∗ ) kk = [from (3)] == ( µ ( e ) ⊕ µ (¯ s j p L ∗ i ) µ (¯ s j p L ∗ i + L ∗ i ) ∗ ) kk == ( µ ( e ) ⊕ µ (¯ s j p ) µ ( L ∗ i ) µ (¯ s j p L ∗ i + L ∗ i ) ∗ ) kk . As discussed in case 1, since R n × nmax is closed under finite multiplications, thenthere must be an element of either matrix µ (¯ s j p ) or matrix µ ( L ∗ i ) µ (¯ s j p L ∗ i + L ∗ i ) ∗ that is + ∞ . Since µ (¯ s j p ) ∈ R n × nmax , then at least one element of matrix µ ( L ∗ i ) µ (¯ s j p L ∗ i + L ∗ i ) ∗ must be + ∞ . Therefore, a + ∞ must be also containedin µ ( e ) ⊕ µ ( L ∗ i ) µ (¯ s j p L ∗ i + L ∗ i ) ∗ = [from (3)] = µ ( L ∗ i (¯ s j p L ∗ i ) ∗ ) ∗ = [from (2)] == µ ( L ∗ ( i ¯ s j p L ∗ ) ∗ i ) ∗ = µ ( L ∗ ( s j L ∗ ) ∗ i ) ∗ (cid:22) [since { s j } ⊆ L ] (cid:22) µ ( L ∗ ( L + ) ∗ i ) ∗ == [from (4)] = µ ( L ∗ i ) ∗ . µ ( L ) ∗ ∈ R n × nmax , µ ( i ) ∈ R n × nmax , then µ ( L ∗ i ) ∈ R n × nmax . Therefore, using Proposition 2, G ( µ ( L ∗ i )) / ∈ Γ, and, from Propositions 3(which holds for matrices in R max , too, see Remark 1) and 6, there should be i, k such that+ ∞ = ( µ ( L ∗ i ) ∗ ) ii = (( µ ( L ) ∗ µ ( i )) ∗ ) ii = (( µ ( i ) µ ( L ) ∗ ) ∗ ) kk = ( µ ( i L ∗ ) ∗ ) kk , but this is excluded by hypothesis. This implies that for all i , for all s j of theform s j = i ¯ s j p , ( µ ( s j ) µ ( i + L ) ∗ ) ii (cid:54) = + ∞ .Since every word in L is of the form of cases 1 or 2, for all i , ( µ ( L ) µ ( i + L ) ∗ ) ii (cid:54) = + ∞ . Hence, we have µ ( i + L ) ∗ ii (cid:54) = + ∞ , and this completes the proof. Theorem 7.
Let G ( P, I ) = ( N, { p , i } , µ, E ) and S = S ( { p } , { i } , (cid:4) n (cid:5) ) . Then G ( P, I ) ∈ Γ M if and only if G ( µ ( p S ∗ )) ∈ Γ and G ( µ ( i S ∗ )) ∈ Γ .Proof. “ ⇒ ”: the proof comes from the fact that ( p S ∗ ) ∗ ⊆ ( p + i ) ∗ and ( i S ∗ ) ∗ ⊆ ( p + i ) ∗ .“ ⇐ ”: from Lemmas 5 and 6, we have ∀ i , ( µ ( p + S ) ∗ ) ii = 0 and ( µ ( i + S ) ∗ ) ii =0. From Corollary 1, S ∗ contains all the balanced strings of length ≤ n . Hence,from Proposition 10, ( p + S ) ∗ contains all the strings s of length ≤ n suchthat | s | p ≥ | s | i , and, in the same way, ( i + S ) ∗ contains all the strings s oflength ≤ n such that | s | p ≤ | s | i . Therefore, for every elementary circuit σ fromany node i of the multi–precedence graph G ( P, I ), if its label s is such that | s | p ≥ | s | i , then | σ | W (cid:22) µ ( s ) ii (cid:22) ( µ ( p + S ) ∗ ) ii = 0; otherwise, if | s | p ≤ | s | i then | σ | W (cid:22) µ ( s ) ii (cid:22) ( µ ( i + S ) ∗ ) ii = 0.In the following statements, we generalize the result of the previous the-orem to multi–precedence graph G ( P, I, C ) and, finally, to parametric multi–precedence graph G ( λP, λ − I, C ). Lemma 8.
Let G ( P, I, C ) = ( N, { p , i , c } , µ, E ) , P = c ∗ pc ∗ , I = c ∗ ic ∗ and S = S ( P , I , (cid:4) n (cid:5) ) . Then G ( P, I, C ) ∈ Γ M if and only if G ( C ) ∈ Γ , G ( µ ( P S ∗ )) ∈ Γ ,and G ( µ ( I S ∗ )) ∈ Γ .Proof. “ ⇒ ”: the proof comes from the fact that c ∗ ⊆ ( p + i + c ) ∗ , ( P S ∗ ) ∗ ⊆ ( p + i + c ) ∗ and ( I S ∗ ) ∗ ⊆ ( p + i + c ) ∗ .“ ⇐ ”: let us note that, since for all i P ii (cid:54) = −∞ and, from G ( C ) ∈ Γ, ( C ∗ ) ii =0 (see Proposition 3 and Remark 1), then µ ( c ∗ pc ∗ ) ii = ( C ∗ ⊗ P ⊗ C ∗ ) ii (cid:54) = −∞ ;moreover, µ ( c ∗ pc ∗ ) , µ ( c ∗ ic ∗ ) ∈ R n × nmax . From Theorem 7, the hypotheses implythat G ( µ ( P ) , µ ( I )) = ( N, { ˜ p , ˜ i } , ˜ µ, ˜ E ) ∈ Γ M , where ˜ µ (˜ p ) = µ ( P ), ˜ µ (˜ i ) = µ ( I ).Therefore, for all i , ( µ ( P + I ) ∗ ) ii = ( µ ( c ∗ pc ∗ + c ∗ ic ∗ ) ∗ ) ii = 0, and ( µ ( c ) ∗ ) ii = 0.In the following we prove that ( p + i + c ) ∗ = ( c ∗ pc ∗ + c ∗ ic ∗ ) ∗ + c ∗ . Indeed,( p + i + c ) ∗ = [from (1)] = ( c ∗ ( p + i )) ∗ c ∗ = [from (2)] = c ∗ (( p + i ) c ∗ ) ∗ == [from (3)] = c ∗ + c ∗ ( p + i )( p + i + c ) ∗ ; (13)24oreover, ( c ∗ pc ∗ + c ∗ ic ∗ ) ∗ = ( c ∗ ( p + i ) c ∗ ) ∗ = [from (3)] == e + c ∗ ( p + i )( c ∗ ( p + i ) + c ) ∗ == e + c ∗ ( p + i )( p + i + c + c + ( p + i )) ∗ == e + c ∗ ( p + i )( p + i + c ) ∗ . Therefore, Equation (13) can be rewritten as( p + i + c ) ∗ = c ∗ + c ∗ ( p + i )( p + i + c ) ∗ = c ∗ + e + c ∗ ( p + i )( p + i + c ) ∗ == c ∗ + ( c ∗ pc ∗ + c ∗ ic ∗ ) ∗ . Therefore, for all i ,( µ ( p + i + c ) ∗ ) ii = ( µ ( c ∗ pc ∗ + c ∗ ic ∗ ) ∗ ) ii ⊕ ( µ ( c ) ∗ ) ii = 0 . From Propositions 3 and 5 this implies that G ( P, I, C ) ∈ Γ M . Theorem 9.
Let G ( P, I, C ) = ( N, { p , i , c } , µ, E ) , P = c ∗ pc ∗ , I = c ∗ ic ∗ , S = S ( P , I , (cid:4) n (cid:5) ) , and λ ∈ R . Then, G ( λP, λ − I, C ) ∈ Γ M if and only if G ( C ) ∈ Γ and λ ∈ [ λ min , λ max ] ∩ R , where λ min = mcm( µ ( I S ∗ )) and λ max = (mcm( µ ( P S ∗ ))) − . Proof.
Let G ( λP, λ − I, C ) = ( V, { p λ , i λ , c } , µ λ , A ), where µ λ ( p λ ) = λP , µ λ ( i λ ) = λ − I , µ λ ( c ) = C . Moreover, let P λ = c ∗ p λ c ∗ , I λ = c ∗ i λ c ∗ and S λ = S ( P λ , I λ , (cid:4) n (cid:5) ). From Lemma 8, G ( λP, λ − I, C ) ∈ Γ M if and only if G ( C ) ∈ Γ, G ( µ λ ( P λ S ∗ λ )) ∈ Γ and G ( µ λ ( I λ S ∗ λ )) ∈ Γ. Therefore, we onlyhave to show that G ( µ λ ( P λ S ∗ λ )) ∈ Γ and G ( µ λ ( I λ S ∗ λ )) ∈ Γ if and only if λ ∈ [ λ min , λ max ] ∩ R .Note that, by construction, every string in S λ contains an equal number ofsymbols p λ and i λ . Thus, µ λ ( S λ ) = µ ( S ), since λ and λ − elements in µ λ ( S λ )cancel out. Therefore µ λ ( P λ S ∗ λ ) = µ λ ( c ∗ p λ c ∗ ) µ ( S ∗ ) = C ∗ λP C ∗ µ ( S ∗ ) = λC ∗ P C ∗ µ ( S ∗ ) == λµ ( c ∗ pc ∗ S ∗ ) = λµ ( P S ∗ ) , and, in the same way, µ λ ( I λ S ∗ λ ) = λ − µ ( I S ∗ ) . From Proposition 7, G ( λµ ( P S ∗ )) ∈ Γ iff λ (cid:22) (mcm( µ ( P S ∗ ))) − , and G ( λ − µ ( I S ∗ )) ∈ Γ iff λ (cid:23) mcm( µ ( I S ∗ )) . We conclude this section with the proof of Theorem 2.25 roof of Theorem 2.
Large part of the proof is a consequence of the previoustheorem. Indeed, note that the “for” cycle of Algorithm 1 computes µ ( S ( P , I , (cid:4) n (cid:5) )), where µ ( P ) = C ∗ P C ∗ , µ ( I ) = C ∗ IC ∗ . Therefore, λ min and λ max , as defined in the previous theorem, coincide with λ ≤ ρmin and λ ≤ ρmax computed in Algorithm 1. The only missing piece for concluding the proofis to justify lines 11-12 of Algorithm 1. In other terms, we have to showthat, if G ( µ ( S )) / ∈ Γ, then Λ (
P, I, C ) = ∅ (in this way, we can avoid thecomputation of µ ( S ) ∗ , which becomes NP-hard when G ( µ ( S )) / ∈ Γ [6]). Infact, G ( µ ( S )) / ∈ Γ implies that ∃ i such that ( µ ( S ) ∗ ) ii = + ∞ (see Proposi-tion 3 and Remark 1). Recalling that ∀ i µ ( P ) ii (cid:54) = −∞ (see the proof ofLemma 8), we have that ∃ i such that µ ( P S ∗ ) ii = + ∞ . From the previ-ous theorem we would have λ max = (mcm( µ ( P S ∗ ))) − = −∞ , which impliesΛ ( P, I, C ) = [ λ min , λ max ] ∩ R = ∅ , since [ λ min , λ max ] is either the empty set orthe singleton {−∞} .This concludes the proof of the part of Theorem 2 pertaining with Algo-rithm 1. The proof of the part of Theorem 2 pertaining with Algorithm 2 isanalogous.
6. Conclusions
In the present paper, we examine the
Proportional-Inverse-Constant-Non-positive Circuit weight Problem (PIC-NCP), which consists in finding all thevalues of λ for which the parametric directed graph G ( λP ⊕ λ − I ⊕ C ) doesnot contain circuits with positive weight. The problem generalizes the NCPto a class of parametric graphs that is larger than the ones already studiedin the literature. After showing that the problem can be solved using linearprogramming, we present an algorithm that solves it in strongly polynomialtime O ( n ) and provides a closed formula for the solution set. The algorithm isbased on a connection between square matrix operations in max-plus algebra,graph theory and formal languages. The interest for this problem comes fromthe study of a specific class of discrete-event systems: indeed, given a P-timeevent graph with at most 1 initial token per place, the set of periods of all d -periodic trajectories that are consistent for the P-time event graph can be found,in strongly polynomial time, by solving a certain instance of the PIC-NCP [26].To conclude, we state an open problem related to our work. We remarkthat a more general class of NCP can be solved using the same algorithmpresented in this paper. Indeed, let us consider a max-plus Laurent poly-nomial in one variable λ ∈ R and matrix coefficients A ( − n I ) , A ( − n I +1) , . . . ,A ( n P ) ∈ R n × nmax , with n P , n I ∈ N : (cid:76) n P j = − n I λ j A ( j ) . The parametric prece-dence graph G ( (cid:76) n P j = − n I λ j A ( j ) ) can always be transformed into one of the form G ( λP ⊕ λ − I ⊕ C ) by adding auxiliary nodes and arcs (obtained expanding λ j into | j | products λ · · · λ if j > λ − · · · λ − if j < − G ( (cid:76) n P j = − n I λ j A ( j ) ) becomes pseudo-polynomial using this approach, since it increases with n P and n I . The problemcan be solved in weakly polynomial time using linear programming; however,26o strongly polynomial algorithm that solves it is known. Its discovery wouldhave important practical implications, as this algorithm could be used to checkthe existence of consistent d -periodic trajectories in strongly polynomial timecomplexity in general P-time event graphs (with no restriction on the numberof initial tokens per place). Acknowledgment
This work was funded by the Deutsche Forschungsgemeinschaft (DFG, Ger-man Research Foundation), Projektnummer RA 516/14-1. Partially supportedby the GACR grant 19-06175J, by MSMT INTER-EXCELLENCE projectLTAUSA19098, and by RVO 67985840.
References [1] Fran¸cois Baccelli, Guy Cohen, Geert Jan Olsder, and Jean-Pierre Quadrat.Synchronization and linearity: an algebra for discrete event systems. 1992.(Cited on pages 4 and 7.)[2] Tassadit Becha, Redouane Kara, S Collart Dutilleul, and Jean JacquesLoiseau. Modelling, analysis and control of electroplating line modelledby P-time event graphs.
IFAC Proceedings Volumes , 46(24):311–316, 2013.(Cited on page 2.)[3] Peter Butkoviˇc.
Max-linear systems: theory and algorithms . Springer Sci-ence & Business Media, 2010. (Cited on pages 2, 7, and 12.)[4] Peter Butkoviˇc. A note on tropical linear and integer programs.
Journalof Optimization Theory and Applications , 180(3):1011–1026, 2019. (Citedon page 3.)[5] Soizick Calvez, Pascal Aygalinc, and Wael Khansa. P-time Petri nets formanufacturing systems with staying time constraints.
IFAC ProceedingsVolumes , 30(6):1487–1492, 1997. (Cited on page 2.)[6] Thomas H Cormen, Charles E Leiserson, Ronald L Rivest, and CliffordStein. Graph algorithms. MIT press, 2009. (Cited on pages 1, 8, and 26.)[7] Ali Dasdan and Rajesh K Gupta. Faster maximum and minimum meancycle algorithms for system-performance analysis.
IEEE transactions oncomputer-aided design of integrated circuits and systems , 17(10):889–899,1998. (Cited on page 8.)[8] Philippe Declerck. Extremum cycle times in time interval models.
IEEETransactions on Automatic Control , 63(6):1821–1827, 2017. (Cited onpage 2.) 279] Manfred Droste and Werner Kuich. Semirings and formal power series. In
Handbook of Weighted Automata , pages 3–28. Springer, 2009. (Cited onpage 5.)[10] Tibor Gallai. Maximum-minimum S¨atze ¨uber Graphen.
Acta MathematicaHungarica , 9(3-4):395–434, 1958. (Cited on page 7.)[11] St´ephane Gaubert. Performance evaluation of (max,+) automata.
IEEEtransactions on automatic Control , 40(12):2014–2025, 1995. (Cited onpage 8.)[12] St´ephane Gaubert, Ricardo Katz, and Sergei Sergeev. Tropical linear pro-gramming and parametric mean payoff games. In
WING@ ETAPS/IJCAR ,pages 94–110, 2010. (Cited on page 3.)[13] Laurent Hardouin, Bertrand Cottenceau, Ying Shang, and J¨org Raisch.Control and state estimation for max-plus linear systems.
Foundations andTrends ® in Systems and Control , 6(1):1–116, 2018. (Cited on pages 4and 5.)[14] Bernd Heidergott, Geert Jan Olsder, and Jacob Van Der Woude. Max Plusat work: modeling and analysis of synchronized systems: a course on Max-Plus algebra and its applications . Princeton University Press, 2014. (Citedon pages 4 and 6.)[15] Michael Joswig and Georg Loho. Weighted digraphs and tropical cones.
Linear Algebra and its Applications , 501:304–343, 2016. (Cited on page 2.)[16] Richard M Karp. A characterization of the minimum cycle mean in adigraph.
Discrete mathematics , 23(3):309–311, 1978. (Cited on page 2.)[17] Richard M Karp and James B Orlin. Parametric shortest path algorithmswith an application to cyclic staffing.
Discrete Applied Mathematics , 3(1):37–45, 1981. (Cited on pages 2 and 17.)[18] Tae-Eog Lee, Seong-Ho Park, and Chihyun Jung. Steady state analysisof timed event graphs with time window constraints.
Discrete AppliedMathematics , 167:202–216, 2014. (Cited on page 2.)[19] Eugene Levner and Vladimir Kats. A parametric critical path problemand an application for cyclic scheduling.
Discrete Applied Mathematics , 87(1-3):149–158, 1998. (Cited on pages 2 and 3.)[20] Georg Loho. Abstract tropical linear programming.
The Electronic Journalof Combinatorics , pages P2–51, 2020. (Cited on page 3.)[21] Antoine Min´e.
Weakly relational numerical abstract domains . PhD thesis,´Ecole Polytechnique, 2004. (Cited on page 2.)[22] Steve Smale. Mathematical problems for the next century.
The mathemat-ical intelligencer , 20(2):7–15, 1998. (Cited on page 3.)2823] Pavel ˇSpaˇcek, Jan Komenda, and S´ebastien Lahaye. Analysis of P-timeevent graphs in (max,+) and (min,+) semirings.
International Journal ofSystems Science , 0(0):1–16, 2021. doi: 10.1080/00207721.2020.1837992.URL https://doi.org/10.1080/00207721.2020.1837992 . (Cited onpage 17.)[24] Neal E Young, Robert E Tarjant, and James B Orlin. Faster parametricshortest path and minimum-balance algorithms.
Networks , 21(2):205–221,1991. (Cited on pages 2 and 17.)[25] Davide Zorzenon, Jan Komenda, and J¨org Raisch. Bounded consistencyof P-time event graphs. In2020 59th IEEE Conference on Decision andControl (CDC)