The Model Matching Problem for Max-Plus Linear Systems: A Geometric Approach

Linear systems over the max-plus algebra provide a suitable formalism to model discrete-event systems where synchronization, without competition, is involved. In this article, we consider a formulation of the model matching problem for systems of such class, in which the output of a given system, called the plant, is forced, by a suitable input, to track exactly that of a given model. A necessary and sufficient condition for its solvability is obtained by making a suitable use of geometric methods in the framework of systems over the max-plus algebra.

In [15], the matching condition consists in minimizing the distance, in a suitable sense, between the output of the plant and that of a reference model while delaying as much as possible the control action. The tools used for solving the problem are based on residuation theory and some properties of the Kleene star operator. A similar formulation is considered in [16], where the problem is tackled by developing a three-block control structure that implements a precompensation and a feedback action. In a similar vein, we consider here the problem of forcing the plant to generate an output that equals that of a given model, giving in this way a formulation of the problem that more closely mimics the classical MMP for linear systems [17].
The contribution of our study consists in deriving a novel, simple structural necessary and sufficient condition for the solvability of the problem that can be practically checked under suitable conditions.
The rest of this article is organized as follows. In Section II, we introduce notions and tools of the max-plus algebra and we show by an example how they can be used to model a class of discrete-event systems as linear systems over R max . Moreover, we formally state the MMP, we want to study. Section III contains the main result of this work that is a structural geometric necessary and sufficient solvability condition for the considered MMP. An example is provided in Section IV. Finally, Section V concludes this article.

II. BACKGROUND AND PROBLEM STATEMENT
In this section, we recall some basic concepts and the corresponding notation for max-plus linear systems. An example is also provided in order to show how a manufacturing system can be modeled using such formalism.
The max-plus algebra R max consists of the set R ∪ {−∞}, equipped with two operations denoted, respectively, by ⊕ and by ⊗ and defined by a ⊕ b = max {a, b} for a, b ∈ R max and by a ⊗ b = a + b if a, b belongs to R or by (−∞) ⊗ a = a ⊗ (−∞) = −∞ for any a ∈ R max .The neutral element for ⊕ and for ⊗ are denoted, respectively, by and by e and we have = −∞ and e = 0 ∈ R. As ⊗ distributes over ⊕, R max is a semiring.
Semimodules over semirings are analogous to vector spaces over fields and the aspects of their theory that are considered in this article can be dealt with by standard tools of linear algebra, provided the fact that the elements of R max , except , have no inverse with respect to ⊕ is kept into account. An introduction to the theory of semimodules over R max with application to the study of max-plus systems can be found in [9], [11], and [18]. By R n max , we denote the semimodule over R max consisting of the set of all the n-tuples of elements of R max , or vector, equipped with the component-wise and the scalar operations defined in a standard way in terms of ⊕ and ⊗. If v and w are vectors of the same dimension, the relation v ≥ w is understood to hold componentwise. By abuse of notations, ∈ R n max will be used to denote the vector whose components are all equals to , also referred to as the null vector. Subsemimodules of R n max are subsets of elements that are closed with respect to the component-wise and the scalar operations defined in terms of ⊕ and ⊗. Subsemimodules will be denoted by script letters, as V ⊆ R n max . A set of vectors {v 1 , . . ., v n } ∈ V ⊆ R n max is a set of generators for V if any element x ∈ V can be written as a linear combination of the v i s, namely x = n i=1 a i ⊗ v i . Note that not all the subsemimodules of R n max have a finite set of generators and those which enjoy this property are said to be finitely generated.
In particular, (n × m)-matrices with entries in R max can be viewed as elements of R n×m max , so that, given A, B ∈ R n×m max and using subscripts to denote, in a standard way, the elements of a matrix, their Analogously, given A ∈ R n×m max and a ∈ R max , the scalar product a ⊗ A ∈ R n×m max , or simply aA, is defined by (a ⊗ A) ij = a ⊗ A ij . If no confusion arises, will also be used to indicate a matrix whose entries are all equal to . The identity matrix, whose diagonal elements are all equal to e and whose off-diagonal elements are all equal to , is denoted by I n , where the subscript denotes the dimension, or simply by I whenever its dimension is clear from the context. If A is an n × m matrix the semimodule Im A is the subsemimodule of R n max generated by the columns of A. In modeling a situation in which events of n different types may occur, we can consider a so-called n-dimensional dater function d(.) : N → R n max , whose value at k ∈ N is an n-dimensional vector d(k) = (d 1 (k), . . ., d n (k)) in which the ith component d i (k) indicates the time instant at which an event of the ith type occurs for the kth time. Dater functions must be nondecreasing (i.e., such that d(k + 1) ≥ d(k) for each k ∈ N) in order to have physical meaning.
Using the abovementioned notions, we can see a max-plus linear system Σ as a dynamical object whose evolution is defined by the equations where k ∈ N is the event instance index, x(.) : N → X = R n max is the dater of internal events, u(.) : N → U = R m max is the dater of input events, and y(.) : N → Y = R p max is the dater of output events, A ∈ R n×n max , B ∈ R n×m max , and C ∈ R p×n max . Coherently with the usual terminology for dynamical systems, the semimodules X , U, and Y are called, respectively, the state module, the input module, and the output module of the system. Note that in Σ, we have n types of internal events that correspond to the n components of x, m types of input events that correspond to the m components of u and p types of output events that correspond to the p components of y.
The vector x(k) = (x 1 (k), . . ., x n (k)) ∈ R n max indicates that the kth internal event of type i occurs at time x i (k) and a similar interpretation holds for u(k) and for y(k). A sequence {u(k + 1)} k∈N is viewed as an input to Σ, while a sequence {y(k + 1)} k∈N is viewed as an output of Σ.
Example 1: Two types of components, R1 and R2, are used in a manufacturing plant. These raw parts are processed by the machines M1 and M2, respectively, in order to obtain the semifinished parts S1 and S2. These intermediate parts are then assembled together by the machine M3, in order to obtain a unit of final product F1. The machines M1, M2, and M3 require 1, 2, and 4 time units, respectively, to execute their processing cycles. The plant is schematized, from an operational point of view, as shown in Fig. 1. We assume that all the machines involved can process only one part at a time, and that buffers of infinite capacity are present at each stage of the plant. Clearly, these assumptions can be suitably modified, still obtaining a max-plus linear model.  The only type of event that is triggered internally by the system, and is visible from outside it, is the "completion of a cycle by the machine M3," we will refer to this event as an output event. Two types of events are triggered by outside of the system: "arrival of a component of type R1" and "arrival of a component of type R2," we refer to them as input events. We can consider as internal events the ones of type "completion of a cycle by the machine M1" and "completion of a cycle by the machine M2." We can associate a dater function to each of this events, as reported in Table I .
Clearly, the values u 1 (k) and u 2 (k) need to be provided by some external source, while the values of the other variables can be computed using appropriate rules. Events of type "completion of a cycle on the machine M1" can occur only after the previous activity on M1 has been completed and one unit of time has elapsed after a new input raw part of type R1 has been made available. Assuming that all the activity starts as soon as possible, we can express this statement by the following equation: and, using similar arguments, we have The two abovementioned equations are linear in the max-plus algebra and they can be written as or, using a matrix notation and omitting the multiplication operator as usual, as Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply.
The first equation of (2), due to the presence of the term A 0 x(k + 1), describes an implicit relation that has to be made explicit in order to obtain an expression of the form (1). In the max-plus algebra, the least solution of the implicit equation x = Ax ⊕ b (that is: x = max{Ax, b}) can be expressed, by means of the so-called Kleene star A * = n∈N A n 0 , as x = A * b, whenever A * can be given a meaning. In our case, thanks to the fact that A 0 is lower triangular, we have A i 0 = for all i ≥ dim A 0 (note that this holds in general, provided that in the plant to be modeled there are no events that cannot be triggered because of mutual dependence or, in other words, if there are no cyclic paths in the graph describing the sequence of the plant's operations), and therefore, we can compute ). Then, we obtain the following representation of the form (1) of the considered plant: Assuming, for sake of illustration that raw parts of type R1 and R2 arrive together at the time instant 0 and, again, at the instant 1 and simulating the evolution of the system, we get Remark 1: In the physical world, the (k + 1)th occurrence of an event cannot anticipate the kth one and so, using dater representations, any input {u(k + 1)} k∈N is as a nondecreasing sequence. The same must hold for the sequence {x(k + 1)} k∈N that describes the state evolution and this implies that the dynamic matrix A in the defining (1) is greater than or equal to the identity matrix I n , i.e., A ≥ I n , where I n is the n × n-matrix with all elements on the diagonal equal to e and all other elements equal to . Decreasing inputs or systems with a dynamic matrix that is not greater than the identity matrix, or anticipative systems, are, therefore, of little interest and they will not be considered here.
We now have the tools to formalize the problem, we tackle in this article.
Problem 1 (MMP): Given a linear max-plus system of the form (1), called the plant, and a linear max-plus system of the form (1), called the model, with , and y P , y M : N → R p max , the MMP consists in finding, for all possible nondecreasing input sequences {u M (k + 1)} k∈N of the model, an appropriate nondecreasing control input sequence {u P (k + 1)} k∈N for the plant, such that the output {y P (k + 1)} k∈N of this latter equals the output {y M (k + 1)} k∈N of the model, i.e., y P (k + 1) = y M (k + 1) for all k ∈ N.
A more restrictive formulation of the MMP is obtained by requiring that the control signal can be computed as a linear function of the state of the plant and of the state and the input of the model, which can be viewed as a feedback map.
is a solution for the corresponding MMP. Remark 2: Since in the given formulation of the FMMP the entries of F and G are not required to be positive real numbers, it may happen that some components of u P (k + 1) computed by (5) are smaller than some component of u M (k + 1), or even that u P (k + 1) < u M (k + 1). According to the meaning of the daters u P (.) and u M (.), this implies that, in order to satisfy the matching requirement, the plant must receive (some components of) its (k + 1)-input before the model has received (some components of) its (k + 1)-input. Therefore, since the knowledge of u M (k + 1) is necessary to compute u P (k + 1), the control law constructed by means of (5) is physically implementable only if the time at which the model receives (each component of) its k-input is appropriately known in advance. For instance, this happens in practice when the sequence of input events of the model is scheduled in advance to satisfy some specific requirements or to comply with some specific policy. In such cases, the value of x P (k) and x M (k) can be obtained by simulating the joint dynamics, using the previous states and the scheduled value for u M (k).

III. SOLUTION OF THE PROBLEMS
Given the plant Σ P described by (3)  N → R (n P +n M ) max and the related joint dynamics, which is described by the equation with It is possible, then, to reformulate the control problem expressed in Problem 1 as that of finding, for any input {u M (k + 1)} k∈N , a control input {u P (k + 1)} k∈N that keeps x E (k) inside the output equalizer In the framework of max-plus systems, control problems of this type, in which the control objective is that of constraining x(k) inside a given subsemimodule, have been considered and dealt with by employing a structural geometric approach in [9] and [19]. Remark 3: Viewing {u M (k + 1)} k∈N as a disturbance input and {u P (k + 1)} k∈N as a control input, the abovementioned formulation essentially reduces the MMP to a disturbance decoupling problem, as it happens in the case of classical linear systems with coefficients in a field or in a ring. In those cases, it is possible to consider the difference between the output of the plant and that of the model and to describe the resulting control problem as that of keeping the state inside the kernel of such function [20]. Differences cannot be computed in the max-plus algebra and, in general, it is not possible to find a matrix C E such that the output equalizer subsemimodule K defined in (7) is the kernel of C E , neither using the classical definition of kernel (i.e., Ker A = {x ∈ R nr max , such that Ax = }, where n r is the number of rows of A), nor the alternative definition, more convenient in the max-plus case, given by some authors (see, for instance, [12]) in terms of congruence (i.e., max , such that Ax = Ay}). This means that it is not possible to associate to the dynamics (6) a linear output map that represents the difference between the output of the plant and that of the model. Note, however, that the output equalizer subsemimodule K defined in (7) is the pull-back, in the category of modules over R max , of the pair of maps (C P , C M ) and, as such, it generalizes the notion of kernel of the difference between these two maps [21]. Note that it would be possible to proceed differently by introducing the operator , defined over R max by a b = a − b for a, b ∈ R, by a = a = a for any a ∈ R max and by = e. This, actually makes it possible to write and the MMP reduces to find, for any disturbance input {u M (k + 1)} k∈N , a control input {u P (k + 1)} k∈N such that y E (k) = e for all k ∈ N. However, the output (8) is nonlinear and it cannot be conveniently handled in this context. For such reason, we do not follow this approach. In order to deal with the MMP in the formulation that consists in keeping x E (k) inside the output equalizer subsemimodule K, it is convenient to make use of a structural geometric approach that extends those developed for classical linear systems with coefficients in a field in [22] and [23]. Extensions of such approach to systems with coefficients in a ring [24]- [26] and, then, in a semiring [3], [9], [11]- [13] have been considered by several authors. Here, we recall the basic notion of controlled invariant subsemimodule for max-plus linear systems given in [9] and some related results.
Definition 1: Given a max-plus linear system Σ of the form (1), a subsemimodule V ⊆ R n max is said to be an Given a max-plus linear system Σ of the form (1) and a subsemimodule of its state semimodule K ⊆ R n max , the set of all the (A, B)controlled invariant subsemimodules contained in K is a semilattice with respect to inclusion and sum of semimodules, so a maximum element, denoted V * (K), exists.
The sequence of semimodules V k defined by where A −1 (Y)={v ∈ R n max , such that Av∈Y} and V k−1 Im B = {x∈R n max , for which there exists u∈R m max such that As it happens for systems with coefficients in a ring, the sequence (9) does not necessarily converge in a finite number of steps, and therefore, it does not provide, in general, an algorithm for the computation of V * (K), as its counterpart does for systems with coefficients in a field [23].
Remark 4: If K is finitely generated, then the semimodules V k are finitely generated for all k ∈ N. In fact, given some finitely generated semimodules Z and Y, the semimodules Y Z, A −1 (Y), and Y ∩ Z are all finitely generated (see [18,Corollary 86]). As explained in [9, Remark 1], their generators can be obtained as the set of solutions of appropriate systems of linear equations over the max-plus algebra R max .
Definition 2: Given a max-plus linear system Σ of the form (1), a subsemimodule V ⊆ R n max is said to be an (A, B)-controlled invariant subsemimodule of feedback type if there exists a matrix F ∈ R m×n Clearly, (A, B)-controlled invariance of feedback type implies (A, B)-controlled invariance. In the framework of systems with coefficients in a field, the two properties are known to be equivalent [22], [23], but this is not true in the case of systems with coefficients in a ring [24], [25] or in a semiring [9] and, in particular, in the case of the max-plus systems considered here.
We can now state the main result of this work that is a necessary and sufficient condition for the existence of a solution to the MMP.
Theorem 1: Given a plant Σ P of the form (3) and a model Σ M of the form (4), assume that A P ≥ I n P and A M ≥ I n M . Then, the related

MMP is solvable if and only if for all
is the maximum (A E , B 1 )-invariant semimodule contained in the output equalizer semimodule K defined by (7). Proof: If. By (A E , B 1 )-controlled invariance of V * (K), it follows that given x E (k) ∈ V * (K), there exists u 1 (k + 1) ∈ R m P max such that A E x E (k) ⊕ B 1 u 1 (k + 1) belongs to V * (K). Moreover, by hypothesis, given u M (k + 1) ∈ R m M max , there exists u 2 (k + 1) ∈ R m P max such that B 1 u 2 (k + 1) ⊕ B 2 u M (k + 1) belongs to V * (K). We can then construct recursively a control input {u P (k + 1)} k∈N for the dynamics (6) as More precisely, we start by taking u 2 (1) such that B 1 u 2 (1) ⊕ B 2 u M (1) ∈ V * (K) and we set u P (1) = u 2 (1). Then, we compute x E (1) by means of (6), x E (0), u P (1), and u M (1), and we take u 1 (2) and . We set u P (2) = u 1 (2) ⊕ u 2 (2) ⊕ u P (1) and we iterate the same procedure increasing by 1 the index k at each step. Note that the sequence {u P (k + 1)} k∈N , thanks to the presence of the term u P (k) in the second equation of (10), is nondecreasing and it gives rise to the following state evolution: (11) In (11), the term B 1 u P (k) is irrelevant, since, by induction, we have x E (k) ≥ B 1 u P (k) and hence, thanks to the assumption A E ≥ I, also A E x E (k) ≥ B 1 u P (k). Then, disregarding this last term, we can show by induction that the state evolution {x E (k)} k∈N given in (11) is contained in V * (K). In fact, x E (0) = belongs to V * (K). Moreover, by the definition of u 1 (.), it follows that the summand (A E x E (k) ⊕ B 1 u 1 (k + 1)) in the right-hand term of (11) is contained in V * (K) if x E (k) is contained in V * (K). Finally, the second summand (B 1 u 2 (k + 1) ⊕ B 2 u M (k + 1)) in the right-hand term of (11) is contained in V * (K) by the definition of u 2 (k + 1). Since V * (K) ⊆ K, by the definition of K given in (7), it follows that the output {y P (k + 1)} k∈N of the plant generated by the input {u P (k + 1)} k∈N defined by (10) is equal to the output {y M (k + 1)} k∈N of the model generated by the input {u M (k + 1)} k∈N and the MMP is solved.
Only if: If the condition of the theorem does not hold, there exists an input vectorū M such that B 2ūM ⊕ B 1 u P / ∈ V * (K) for any u P ∈ R m P max . Then, for the constant input {u M (k + 1)} k∈N with u M (k + 1) =ū M for k ∈ N, we have, from (6) that does not belong to V * (K) for any value u P (1) ∈ R m P max and also x E (1) ≥ B 2ūM . The latter inequality, thanks to the assumption A E ≥ I, implies recursively In other words, x E (k + 1) cannot be kept indefinitely inside the subsemimodule K and, as a consequence, the MMP cannot be solved.
Remark 5: The condition expressed by Theorem 1 can be equivalently written, using the operator introduced in (9), as ImB 2 ⊆ V * (K) ImB 1 and it can be practically checked using the same techniques described in Remark 4.
For the feedback version stated in Problem 2, we can state the following solvability condition.
More precisely, we start by taking . Then, we compute x E (1) by means of (6), x E (0), u P (1) and u M (1), and we take u P (2) = F x E (1) ⊕ Gu M (2). We iterate the same procedure increasing by 1 the index k at each step. The sequence {x E (k + 1)} k∈N that is generated, together with {u P (k + 1)} k∈N , during the iteration, is nondecreasing, since A E ≥ I n P +n M . Since also {u M (k + 1)} k∈N is assumed to be nondecreasing, the input {u P (k + 1)} k∈N turns out to be nondecreasing. The resulting state evolution clearly evolves in V ⊆ K and, hence, the MMP is solved.
Only if. Assume that the FMMP is solved by a control law of the form (5). Then, the set of reachable states for the dynamics (13)  The solvability condition for the FMMP given in Theorem 2 is stronger than the solvability condition for the MMP given in Theorem 1, since any (A, B)-controlled invariant of feedback type V contained in K is also contained in V * (K) due to the maximality of the latter, and V * (K) is not necessarily of feedback type. Therefore, the solvability of the FMMP implies the solvability of the MMP and any solution of the first is a solution also of the second. In particular, if the solvability condition given in Theorem 2 is satisfied, the solution {u P (k + 1)} k∈N given by (12), being nondecreasing, can be expressed as Letting u 1 (k + 1) = F x E (k) and u 2 (k + 1) = Gu M (k + 1), (14) shows that the procedure indicated in the proof of Theorem 2 provides the same control input we can have from (10) in the proof of Theorem 1.
Remark 7: In practice, the condition of Theorem 1 can be checked and the elements u 1 (k + 1), u 2 (k + 1) that are needed in (10) to construct the control input {u P (k + 1} k∈N can be found by solving systems of linear equations over the max-plus algebra R max that involve the matrices A E , B 1 , B 2 and the generators of V * (K). The same holds for the condition of Theorem 1 and for the matrices F , G that are needed in (12). Since inverses with respect to ⊕ do not exist in R max , the general systems of linear equations in the vector indeterminate ξ over R max one has to deal with takes the bilateral form where M and N are known matrices and α and β are known vectors of compatible dimensions with elements in R max (see [2]). Computational problems that arise in dealing with such systems of equations are illustrated in [9] and [18]. Elimination methods can be applied to find solutions, as described in [9] and [27], possibly with the aid of a dedicated Scilab toolbox [28]. An example of how to deal in practice with the computations involved in solving the FMMP is given in the following section.

IV. EXAMPLE
In this section, we provide an example to illustrate the previous results.
Let us consider a plant Σ P of the form (3) described by and a model Σ M of the form (4) described by The related joint dynamics is given by and The output equalizer subsemimodule K is easily seen to be given by the set of vectors in R 3 max whose last component is equal to the maximum of the first two components, namely and we also have ) does not belong to K, but it can be proved to be (A E , B 1 )-invariant of feedback type and, hence, To show that K is (A E , B 1 )-invariant of feedback type, we need to solve the two sided linear max-plus system of equations whose set of solutions (F, Q) is a finitely generated max-plus set [9]. This can be done, first, by rewriting (17) as a system of max-plus linear equations in the vector indeterminate ξ of the form (15) and, then, by solving it by implementing the technique presented in [27]. To accomplish the first step, let us consider separately each column K i , with i = 1, 2, of K in the left-hand side of (17), so obtaining a set of equations of the form Now, for the max-plus product F K i , we can write F K i = Δ(K 1 , K 2 )f where f is a vector in R (n M +n P )m P max that consists of all the columns of F stacked on top of each other in lexicographic order and Δ(K 1 , K 2 ) is a block-diagonal matrix in R m P ×((n P +n M )m P ) max whose diagonal blocks are all equal to K i . Substituting in (18), we get that is an equation of the form (15) with ξ = ( f Q i ) ∈ R (n P +n M )m P +2 max , M = ( B 1 Δ(K 1 , K 2 ) ) ∈ R (n P +n M )×((n P +n M )m P +2) max , α = A E K i ∈ R n P +n M max , N = ( K ), β = , and N and β have the same dimensions of M and α, respectively.
Using elimination methods, as mentioned in Remark 7, it is possible to find a solution of (19) and then a solution of (17) [we do not report here the single elementary steps of the computation, but the reader can easily verify that the pair (F, Q) given above solves (17)]. In particular, the control law u P (k + 1) = F x E (k) keeps inside K any state evolution, which starts in K. ) belongs to K for G = (2). Hence, according to the proof of Theorem 2, a solution to the FMMP turns out to be given by the control law u P (k + 1) = F x E (k) ⊕ Gu M (k + 1) that is of the form (5). In fact, by substituting u P (k + 1) with the abovementioned expression in the joint dynamics (6) we get ⎛ ⎝ x P 1 (k + 1) x P 2 (k + 1) and y P (k + 1) = x P 1 (k + 1) ⊕ x P 2 (k + 1) = 3x P 1 (k) ⊕ 3x P 2 (k) ⊕ 4u M (k + 1) = 3y P (k) ⊕ 4u M (k + 1) From the last expression, since x P (0) = x M (0) = , it is easy to see by induction that {y P (k + 1)} k∈N is equal to {y M (k + 1)} k∈N . Obviously, the found solution of the FMMP is a solution also of the MMP and, as explained in Remark 6, the control law (20) satisfies the requirement of Problem 1.

V. CONCLUSION
A natural formulation of the matching problem for max-plus systems has been given and the problem has been tackled in the framework of the geometric approach. This provides solvability conditions that basically extend those originally found in the framework of classical linear systems, showing, in particular, the validity and the potential of the geometric approach also for this class of systems. Future work will consider the extension of the methods and of the results to max-plus systems that have a switching structure and can, therefore, model the behaviour of real plants in varying operational conditions.