# Semi-Markov Model of the System of Repairs and Preventive Replacements by Age of City Buses
## 3 Determination of the Criterion Function  
For the directed graph shown in Figure 1, a mathematical model was built assuming that it is a stochastic process X(t). The mathematical model was developed using the theory of semi-Markov processes [30; 31]. The paper considers a 5-state semi-Markov model of renewals (preventive repairs and replacements) with a state space S = {1, 2, 3, 4, 5}. If X(t) = i, then the technical object under consideration at time t is in state i. In the case when the transition probabilities between the states of the modelled process are known, it is possible to determine the Markov chain inserted in the semi-Markov process. The transition matrix of the Markov chain for the model under consideration has the form  
\[\mathrm{P}=\left[ \begin{array}{cccc}0&\mathrm{P}_{12}&\mathrm{P}_{13}& \mathrm{P}_{14}&\mathrm{P}_{15}\\ \mathrm{P}_{21}&0&0&0&0\\ \mathrm{P}_{31}&0&0&\mathrm{P}_{34}&0\\ \mathrm{P}_{41}&0&0&0&0\\ \mathrm{P}_{51}&0&0&0&0\end{array} \right] \tag{1}\]  
where  
\(\mathrm{P}_{ij}\), i, j = 1, 2, 3, 4, 5--probability of transition from state i to state j. To determine the limiting probabilities for a Markov chain, the following matrix system must be solved:  
\[\mathrm{P}^{\mathrm{T}}\cdot\Pi=\Pi\left[ \begin{array}{cccc}0&\mathrm{P}_{2 1}&\mathrm{P}_{31}&\mathrm{P}_{41}&\mathrm{P}_{51}\\ \mathrm{P}_{12}&0&0&0&0\\ \mathrm{P}_{13}&0&0&0&0\\ \mathrm{P}_{14}&0&\mathrm{P}_{34}&0&0\\ \mathrm{P}_{15}&0&0&0&0\end{array} \right]\cdot\left[ \begin{array}{c}\pi_{1 }\\ \pi_{2}\\ \pi_{3}\\ \pi_{4}\\ \pi_{5}\end{array} \right]=\left[ \begin{array}{c}\pi_{1}\\ \pi_{2}\\ \pi_{3}\\ \pi_{4}\\ \pi_{5}\end{array} \right] \tag{2}\]  
where  
\(\pi_{\mathrm{i}}\), i = 1, 2, 3, 4, 5--the limiting probability of a Markov chain inserted in a semi-markov process. The Matrix System (2) can be replaced by a system of linear Equation (4) in which, in order to obtain an unambiguous solution, a normalization condition is introduced (3)  
\[\sum_{\mathrm{i}}\pi_{\mathrm{i}}=1 \tag{3}\]  
Figure 1: Directed graph representation of the state changes of a city bus renewal system model with state spaces S = {1, 2, 3, 4, 5}. then the system of linear Equation (4) takes the form  
\[\left\{ \begin{array}{l}\pi_{1}+\pi_{2}+\pi_{3}+\pi_{4}+\pi_{5}=1\\ \mathrm{P}_{12}\cdot\pi_{1}=\pi_{2}\\ \mathrm{P}_{13}\cdot\pi_{1}=\pi_{3}\\ \mathrm{P}_{14}\cdot\pi_{1}+\mathrm{P}_{34}\cdot\pi_{3}=\pi_{4}\\ \mathrm{P}_{15}\cdot\pi_{1}=\pi_{5}\\ \end{array} \right. \tag{4}\]  
As a result of solving the system of linear Equation (4), formulas representing the limiting probabilities for the analysed Markov chain were obtained:  
\[\pi_{1}=\frac{1}{\mathrm{m}}\pi_{2}=\frac{\mathrm{P}_{12}}{\mathrm{m}}\pi_{3} =\frac{\mathrm{P}_{13}}{\mathrm{m}}\pi_{4}=\frac{\mathrm{P}_{13}\cdot\mathrm{ P}_{34}+\mathrm{P}_{14}}{\mathrm{m}}\pi_{5}=\frac{\mathrm{P}_{15}}{\mathrm{m}} \tag{5}\]  
where  
\[\mathrm{m}=1+\mathrm{p}_{12}\cdot\mathrm{P}_{13}\cdot\left(1+\mathrm{p}_{34} \right)+\mathrm{P}_{14}+\mathrm{P}_{15}\]  
In this paper, a semi-Markov model of renewals (preventive corrective maintenance and age-replacement) is analysed. A 5-state semi-Markov process X(t) with state space S = {1, 2, 3, 4, 5} is considered. By z\({}_{i}\), i = 1, 2, 3, 4, 5 means the profit (cost) per unit (per time unit) for the state i. It is assumed in the paper, that z\({}_{1}\) > 0, z\({}_{i}\) < 0 for i = 2, 3, 4, 5. This means that if the technical object is in state 1, then a profit is generated, while if the technical object is in state i = 2, 3, 4, 5, then a cost (loss) is generated. In the paper [28] it was proved, that the summary profit (loss) per unit of time generated in the system is expressed by the formula  
\[\mathrm{Z}=\frac{\sum\limits_{i}\pi_{i}\cdot\mathrm{ET}_{i}\cdot\mathrm{z_{ i}}}{\sum\limits_{i}\pi_{i}\cdot\mathrm{ET}_{i}} \tag{6}\]  
where  
ET\({}_{i}\), i = 1, 2, 3, 4, 5-average time spent in state i. A technical object is subject to renewal at age T or when it is damaged, whatever comes first.