Tropical Lexicographic Optimization: Synchronizing Timed Event Graphs

Tropical Algebra is used to model the dynamics of Timed Event Graphs (TEG), a particular class of Timed Discrete-Event System (TDES) in which we are interested only in synchronization and delay phenomena. Whenever this TEG has control inputs, we can use them to control the synchronization of the system to achieve some objective. Thus, this paper formulates a framework based on tropical algebra and lexicographic optimization to synchronize a TEG when dealing with many synchronization objectives that are ranked in previous priority order. We call this kind of problem the Tropical Lexicographic Synchronization Optimization (TLSO). This work develops a solution to this problem, based on Tropical Fractional Linear Programming (TFLP) and lexicographic optimization concepts. In this way, the basics of tropical algebra are determined, including essential terms to this paper, such as left and right residuations, and the following stages of the solution to the TLSO problem are explained. Therefore, this work presents a general framework based on structured algebraic models with application to TEG synchronization. By synchronization, we mean balancing and organizing events chronologically in order to achieve the desired goal. So, we are dealing with concepts closely related to symmetry ones. An illustrative numerical example is presented, which demonstrates the implementation of the proposed algorithms. The acquired results confirm the efficiency of the proposed methodology. Codes used for implementing the algorithms are listed in the appendix section of the article.


Introduction
Timed Event Graphs (TEGs) are used to model a wide range of Timed Discrete-Event Systems (TDES), which is a class of dynamic systems in which the change of state is governed by events [1]. Examples of model applications include manufacturing systems, production chains, queues, and urban traffic systems [2].
A powerful tool for analysis of TEGs is the so-called Tropical Algebra, which is a kind of idempotent algebraic structure which can be a semiring or a semifield depending on the application. French researchers gave the denomination as a tribute to Brazilian mathematician Imre Simon, who had a considerable influence on the development of automata and semigroup theory [3].
There are many types of tropical algebras that have applications in areas such as mathematics, engineering, and computer science. Two important examples are the Min-Plus and Max-Plus algebra. Concerning Max-Plus algebra, several results were obtained for analysis and synthesis of TDES.

Tropical Algebra
This work is heavily based on tropical algebra. Therefore, in this section, we introduce some concepts and definitions related to this algebra. For more details on academic background, consult a historical review of Max-Plus tropical algebra [2,17,18]. "Tropical algebra" is a generic name for a family of idempotent algebraic structures, which can be a semiring or a semifield depending on the application. A special example of tropical algebra is the so-called Max-Plus Algebra. It is a particular Tropical structure act on the set T max = R ∪ {−∞} with two operations, named a ⊕ b = max(a, b) and a ⊗ b = a + b. Furthermore, let T n max and T n×m max be the set of column vectors with n entries in T max and the set of matrices with n rows and m columns in T max , respectively. From now on, we consider that "Max-Plus algebra" and "tropical algebra" can be used as synonyms, and this paper adopts the latter notation.
This algebra can be extended to matrices and vectors. If A = (A ij ), B = (B ij ), and C = (C ij ) are matrices of compatible sizes with entries in T max , we denote by C = A ⊕ B the tropical matrix sum, in which C ij = A ij ⊕ B ij . Furthermore, we define as C = A ⊗ B the tropical matrix product, in which C ij = k A ik ⊗ B kj . In later notations, we omit the symbol ⊗ and denote the tropical product by juxtaposition, so A ⊗ B = AB. We use the symbol ε to denote −∞. Let ε n×m be a matrix of ε with n rows and m columns. This article denotes the Max-Plus identity matrix of appropriate order, a matrix with 0 in the diagonal and ε outside, by Id T . For a square matrix A, we denote by A k the k th tropical power of A, defined recursively as A k = AA k−1 and A 0 = Id T .
If A is a matrix (or a scalar) let −A be the matrix (or the scalar) obtained by switching the sign of its entries. If a is a vector and b is a scalar b = ε, let a b be (−b)a (all the elements of a subtracted by b).
Let ρ(A) denote the spectral radius of A, i.e., the largest eigenvalue. In Tropical Algebra, the eigenvalue defines the cycle time in a TEG and is still active research topic, with recent results, such as involving nontrivial eigenvectors [19,20]. The symbol is because a b is the analog of a division in Max-Plus A i . It is assumed from now on that the reader is familiar with the basics of this algebra, including concepts as Kleene closure [21].

Remark 1.
Unless stated otherwise, all operations in this paper are done in tropical algebra. So it is essential to be careful with the symbol that we use for the operations.
An important operation in tropical algebra is the residuation. The residuation works as a kind of multiplicative inverse in the matrix tropical algebra. This work defines it below: Definition 1. We define • \, • /-the left and right residuation of the product, respectively-as (see more details in [22]) Note that the residuations are implicitly defined by multiobjective optimization problems, since we want to optimize all the entries of the matrix X of appropriate dimension subject to the constraint XB ≤ A or AX ≤ B. Perhaps surprisingly, there is indeed a solution X, which is optimal in all its entries (the so-called utopical solution in optimization), and it is found by the residuations A • / B and A • \ B.
For instance, consider problem (3) below: Note that this is of the form of (2). Thus, notice that the previous inequality can be rewritten as Let A ∧ B be the entrywise minimum between the matrices A and B. Consequently, Therefore, we have that Note that all the previous operations can be reversed. This implies that X max = (3 2) T is the maximum possible value for the matrix X, optimal in all its entries x 1 and x 2 . This is exactly the (left) residuation: The general formula for computing the left residuation is A• \B = −(A T (−B)). Analogously, for the right residuation, A• /B = −((−A)B T ). In both cases, in the internal tropical product, we consider that −ε + ε = ε.

Tropical Lexicographic Synchronization Programming
In general, the purpose of this research is to synchronize the transitions of the TEGs, which describes the discrete event systems. In this section, we propose a framework for establishing synchronization among the transitions of a TEG, a model for TDES. This is applicable in, for instance, traffic light systems synchronization, as is discussed further in this paper. Note that this is only one of the various possible applications of this kind, in which it is desired to have synchronization among transitions.

Motivation
As an example of application of the proposed procedure, consider a traffic light system, in which the goal is to obtain synchronization between phases at adjacent crossings, which allows green waves, a sequence of green lights in continuous crossings. A traffic light system can be modeled as a TEG [13]. Figure 1 illustrates a TEG example in which we have two subsystems, in which each one is related to a crossing. Each transition x i represents a change of phases in each crossing, in which a phase corresponds to a combination of enabled green lights. We also have transitions u i , which represents the control of each phase. This means that we can delay the end of each phase. A correct synchronization of the system allows the creation of green waves. The synchronization consists on having firing times x i as close as possible. Thus, the problem involves choosing the firing times u i , which optimize the synchronization of the system, considering a priority order. Prioritization is necessary because it may not be possible to synchronize all the transitions x i , it is the same as synchronizing the TEG. More details are seen in the next section.
Note that the application of traffic light control is only one of the possible applications. For instance, we could consider manufacture processing and other systems that need sharing and synchronization of resources. The generic framework used to solve these described problems is proposed in the next subsections.

Formulation of the Tropical Lexicographical Synchronization Problem
Consider the Tropical linear system below, in which we have the state x[k] ∈ T n max and input We suppose that our policy for u[k] is u[k] = λ k µ, in which λ is a scalar and µ is a constant vector of the same dimension as u[k]. With this same λ and µ we can obtain a closed-loop controller More precisely, For a fixed choice of λ > ρ(A), we want to choose the vector µ such that the entries of x[k] in steady-state (k ≥ K) are as close as possible, i.e., they are synchronized. Unfortunately, it is not possible to have all the entries of x[k] synchronized (i.e., equal), because we may not have enough freedom in µ to achieve such an objective. So, we need to prioritize the synchronizations. So, it is necessary to define some elements:

•
Let P be the number of pairs of transitions of the TEG that we want to synchronize. • Let L be the list of P pairs of indexes (i(p), j(p)) of entries of x[k] that we want to synchronize, ordered according to a decreasing defined priority. So, for instance, the pair of indexes (i(1), j (1)) is more important to be synchronized than the pair of indexes (i(2), j (2)). Furthermore, we assume that in a pair (i(p), j(p)), , we pre-specify a temporal order on the state in those indexes (the firing time x i(p) comes after the firing time x j(p) , or, in the best case, at the same time).
. This is the synchronization index for the p th pair, which we want to minimize. Since the x n (k) represent the firing times of the transitions for the k th time, δ p represents the delay between the k th firing time of transition x j(p) (k) and the k th firing time of transition x i(p) (k). (So, if δ p equals to 0, the transitions happen simultaneously).
Note that, since x i(p) (k) ≥ x j(p) (k), this is always a non-negative number. Moreover, since , and therefore is independent on both k (that is why the symbol δ p does not depend on k, although the definition seems to depend on k) and λ, depending only on χ, which in turn depends on our decision variable µ according to (9). We finally conclude that a higher priority pair has an utmost priority over a lower priority pair. This implies that we have a lexicographical optimization on the indexes δ p . Let I T p and J T p be the i(p) th and j(p) th row of the matrix M. Let m r be the r th row of M, respectively. Note that It is possible that a pair of (i(p), j(p)) cannot be synchronized, given the previous constraints. In Section 3.5, it is explained how this can be detected. In this case, we need to skip this pair and continue to the next one.
We define problems of this type as Tropical Lexicographic Synchronization Optimization (TLSO). Since the parameters of the problem are the matrix M, the list L, and the scalar λ > ρ(A), we can denote the problem by TLSO(A, B, L, λ).

Lexicographic Optimization Problem
In a general form, a Lexicographic Optimization Problem consists of solving lex min µ f i (µ), i = 1, 2, ..., p, subject to a constraint g(µ) ≤ 0. Note that the objective functions f i (µ) are ordered so an index i has more priority than index i + 1. One procedure to solve this kind of problem consists of solving a sequence of traditional optimization problems for j = 1 to j = p: in which f * i is the optimal value of f i (µ) in the previous problem [12].

Tropical Fractional Linear Programming
We want to solve a TLSO, which is a Lexicographic Optimization Problem. We use the strategy explained in Section 3.3, which reduces lexicographic optimization problems into a sequence of traditional optimization problems. In our case, the particular traditional optimization problems are TFLP. The general form of a TFLP problem is in which w, α, f , β, R, r, S, s are parameters. This kind of problem has been studied in [10,11], and algorithms have been proposed to solve them. The algorithm proposed in [11], in particular, relies on the ability to solve a particular case of TFLP. This particular case is called Max-Type Tropical Linear Problem (Max TLP): max υ g T υ, subject to: Eυ ⊕ e = Dυ ⊕ d.
In order to guarantee that the solution υ for this problem is finite, the constraint of (13) must generate a set, which is upper bounded; in better words, there must exist a finite vector υ max such that υ ≤ υ max . From now on, we assume that this is true.
An algorithm to solve this problem is called Dual Method [11]. This is an iterative method that works with the following recursion: with the initial condition υ(0) = υ max . In each iteration k, the following conditions must be tested: If these conditions are not true, the algorithm halts, and we can conclude that the feasible set of (13) is empty. Otherwise, when the algorithm converges (new υ equal to a previous υ), it is able to find the optimal solution for the optimization problem. Note that the algorithm is independent of g. It turns out that, indeed, the solution µ is independent of these elements (see [11]). Any solution υ which is optimal for a vector g 1 is also optimal for any other g 2 . More generally, any objective function f (υ) which is nondecreasing implies the same behavior. This happens because the algorithm in (14) will find a solution υ inside the feasible set of (13) that is maximal in any entry of υ [24].
When using the discussed Tropical Dual method by solving (14), we can solve the TFLP problems by converting Max-Type TFLP into Max-Type TLP problem according to Figure 2 through Charnes-Cooper conversion [25]. The complete TFLP problem is defined in (12). It is straightforward to adapt the Charnes-Cooper transformation to the tropical setting [11]. Set Then, by dividing (in tropical algebra) both sides of the affine equation on (12) by f T µ ⊕ β, it can be rewritten as max θ,θ w T θ ⊕ αθ, subject to: in which the additional equation f T θ ⊕ βθ = 0 condenses (16). Define the vector Let n and m be the number of rows and columns of R, respectively. With this definition, we can rewrite (17) as max subject to: Remember that ε n×1 is a vector of ε with n rows and one column, and ε 1×m is a vector of ε with one row and m columns. This problem is a Max-type TLP as (13) and can be solved by Algorithm 1. The program's code in the Scicoslab language is listed in Appendix A.1. Once θ andθ are obtained, in order to return to the original variable, one needs to revert (16). The TFLP method is implemented by the function TFLP(w, α, f , β, R, r, S, s), in which w, α, f , β, R, r, S, and s are parameters and it returns µ and δ, in which δ is the value of the optimal objective function, according to the implementation listed in Algorithm 2. The program's code in the Scicoslab language is listed in Appendix A.2.  (20);

Tropical Lexicographic Synchronization Programming
We solve the TLSO (10) using the general strategy proposed in Section 3.3. This implies solving a sequence of TFLPs (12), as discussed in Section 3.4. In this subsection, we describe this procedure in more detail.
First, note that the constraints in problem (10) can be rewritten as lex min µ I T p µ J T p µ p=1,2,...,P subject to: (I T p ⊕ J T p )µ = I T p µ.
Remember that we have a list L of pairs (i(p), j(p)) L = {(i(1), j(1)); (i(2), j(2))...(i(P), j(P))} (22) ordered by a decreasing priority and also that x i(p) (k) ≥ x j(p) (k). So, according to the procedure described in 3.3, the first problem that we need to solve is a TFLP (as in (12)) which can be solved using the procedure described in Section 3.4. After this TFLP is solved, we obtain a solution µ * 1 , and then we compute the first δ 1 as Now, the next step is to create the second problem in the sequence. We need to change the objective function to I T 2 µ − J T 2 µ and also to add two new constraints: The second problem, in addition to the previous constraints and the change of objective function, is augmented by two new constraints, one to synchronize the new pair and another constraint to guarantee the previous result δ 1 : subject to: From the third problem on, up to p = P, we have two more constraints for each new pair: subject to: If the p th pair cannot be synchronized, that is, if the Algorithm 2 returns µ equal to empty, the pair is deleted from the list L, the size P of the list L is updated, and the iteration p is not increased.
The implementation of the TLSO is given by the function TLSO(A,B,L,lambda) in Algorithm 3. The program's code in the Scicoslab language is listed in Appendix A.3, in which the parameters A and B are Max-Plus matrices. In ScicosLab the Max-Plus denomination is used instead of Tropical. L is the priority pairs list L represented by a matrix with P rows and two columns, and λ is a scalar that is related to the period. The function TSLP returns the optimal µ * .
It is important to stress that the TLSO is tropical homogeneous-that means, if µ is a solution, so is αµ with α, a scalar. Therefore, we can shift the vector µ that we obtain after we solve the problem, so that all its elements are non-negative. A numerical example is developed in Section 4 to clarify the TLSO method. Define w, f , R, and S (iteration constraints (30) and prior constraints (31)); Define r and s as vector of ; Call the function TFLP and obtain u; if u is empty then erase pair p of the list L and update the size P of list L; else u * = u; p = p + 1; 5. Return u * .

Numerical Example
In this section, we develop a numerical example. We work with the TEG illustrated in Figure 1. As mentioned in the motivation Section 3.1, the illustrated TEG can model a traffic light system, which has two subsystems that refers to crossings. For more about the traffic light modeling with TEGs, see [13,26].
Obtaining matrix M: The TLSO algorithm uses the parameters λ, A, and B to calculate the matrix M = ((−λ)A) * B, as in which, (47) Step one: The algorithm TLSO starts the search by finding an optimal synchronized vector µ by solving the first optimization problem for the first pair of indexes from the list L.
In the first iteration (p = 1), the pair (3,7) from the list L is used, we have i p = 7 and j p = 3. In this way, I 1 (48) is the 7th line and J 1 (49) is the 3rd line of the matrix M: In order to solve the first TFLP problem (see Section 3.4), we use w = I 1 , α = 0, f = J 1 , β = ε, R = I 1 ⊕ J 1 , r = ε, S = I 1 , and s = ε.
The lexicographic algorithm calls the function TFLP (Algorithm 2) for these defined variables (w, α, f , β, R, r, S, s). The function returns the variables µ * 1 : µ * T 1 = −50.6 −12 0 20.8 −27.7 −12 0 33. 5 (50) and δ 1 = 0 (perfect synchronization between the transitions x 7 and x 3 ). In that way, we have the first vector µ * 1 . Second step: At the second iteration (p = 2) the pair (3,8) is used, we have i(2) = 3 and j(2) = 8, being I 2 and J 2 : Once I 3 (56) and J 3 (57) are defined, we compute R and S as Using these parameters R (58) and S (59), the third problem is solved, and the variable µ returns empty, which indicates that the algorithm does not converge and the synchronization is not possible. Therefore, we have to skip this phase and keep the last vector µ * = µ * 2 . Since there are no more pairs to synchronize, the algorithm is over.
As we explained in Section 3.5, we can shift the vector µ in a way that we have only non-negative values. Thus, we use µ = λµ * 2 , obtaining The proposed example in this section clarifies the implementation of the lexicographic algorithm for synchronization among stages according to the previously defined list. In the first iteration, there is the perfect synchronization (δ 1 = 0). In the second iteration, the synchronization is possible with delay (δ 2 = 5.1). Lastly, in the third iteration, it is not possible to synchronize (µ is empty).

Conclusions
In this work, we propose the TLSO (Tropical Lexicographic Synchronization Optimization) framework. This framework is based on TFLP (Tropical Fractional Linear Programming), which allows the formulation and solution of problems in which it is desirable to synchronize transitions of TEGs. As far as the authors' knowledge goes, there are few practical TLFP applications in the literature. Thus, this article's contribution is the formalization and utilization of TFLP for modeling of synchronization problems, in which we develop a numerical example of traffic light synchronization. It is important to note that if synchronization is not feasible, the method will handle it.
The research gap served by this work is the lexicographic proposition together with models resolved by TFLP for synchronization of TEGs subject to delays. The framework proposed in this research is limited to the characteristics resulting from the time events graph model, which applies to systems subjected to synchronization and delay phenomena. The study does not apply to systems where there is a dispute over resources of another nature. As future work, we propose the formulation for broader models, represented by more general TDES. Another possibility for future work is to consider an approach for closed-loop systems. The proposed lexicographic method is also suitable for other systems, such as manufacturing systems, and others in which synchronization and resource sharing are desired.