# Semi-Markov Model of the System of Repairs and Preventive Replacements by Age of City Buses
## 3 Determination of the Criterion Function
By T\({}_{1}\)(x) we define the time to replace or damage (repair) a technical object. The variable T\({}_{1}\)(x) is defined as follows  
\[\mathrm{T}_{1}(\mathrm{x})=\left\{ \begin{array}{r@{\quad}l}\quad\mathrm{T}_ {1},\quad&\mathrm{gdy}\quad&\mathrm{T}_{1}<\mathrm{x}\\ \quad\quad\mathrm{x},\quad&\mathrm{gdy}\quad&\mathrm{T}_{1}\geq\mathrm{x}\\ \quad\quad\mathrm{x},\quad&\mathrm{gdy}\quad&\mathrm{T}_{1}\geq\mathrm{x}\\ \quad\end{array} \right. \tag{7}\]  
It is assumed that after time x, if the technical object has not failed, it transitions to the preventive replacement state. The process of changing states i = 1, 2, 3, 4, 5, given preventive replacement after time x is a new semi-Markov process with a matrix P(x) of transition probabilities of the Markov chain inserted into the semi-Markov process. With respect to the matrix P(1) shown above, only the first row of the matrix P changes, then the matrix P(x) takes the form  
\[\mathrm{P(x)}=\left[ \begin{array}{cccc}0&\mathrm{P}_{12}(\mathrm{x})& \mathrm{P}_{13}(\mathrm{x})&\mathrm{P}_{14}(\mathrm{x})&\mathrm{P}_{15}( \mathrm{x})\\ \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{8}\]while the limiting probabilities determined for a Markov chain (determined analogously to Formulae (5) can be presented as:  
\[ \begin{array}{c}\pi_{1}(x)=\frac{1}{n}\\ \pi_{2}(x)=\frac{p_{12}(x)}{n}\\ \pi_{3}(x)=\frac{p_{13}(x)}{n}\\ \pi_{4}(x)=\frac{p_{13}(x)p_{34}+p_{14}(x)}{n}\\ \pi_{5}(x)=\frac{p_{15}(x)}{n}\\ \end{array}  \tag{9}\]  
where  
\[n=1+p_{12}(x)\cdot p_{13}(x)\cdot\left(1+p_{34}\right)+p_{14}(x)+p_{15}(x)\]  
Based on the paper [28], the Criterion Function (6) is of the form:  
\[ \begin{array}{c}Z=g(x)=\frac{\pi_{1}(x)\cdot ET_{1}(x)\cdot z_{1}+\pi_{2}(x) \cdot ET_{2}\cdot z_{2}+\pi_{3}(x)\cdot ET_{3}\cdot z_{3}+\pi_{4}(x)\cdot ET_{4 }\cdot z_{4}+\pi_{5}(x)\cdot ET_{5}\cdot z_{5}}{\pi_{1}(x)\cdot ET_{1}(x)+\pi _{2}(x)\cdot ET_{2}+\pi_{3}(x)\cdot ET_{3}+\pi_{4}(x)\cdot ET_{4}+\pi_{5}(x) \cdot ET_{5}}\\ \end{array}  \tag{10}\]  
where  
\(ET_{1}(x)\)-average value of time spent in state 1, calculated from the formula [30; 31]  
\[ \begin{array}{c}ET_{1}(x)=\int\limits_{0}^{x}dF_{1}(T)+xP\{T_{1}\geq x\}\\ ET_{1}(x)=\int\limits_{0}^{x}R_{1}(T)dT\\ \end{array}  \tag{11}\]  
\(ET_{2}\), \(ET_{3}\), \(ET_{4}\) and \(ET_{5}\),--average values of times spent in states 2, 3, 4 and 5, respectively. In particular, based on the paper [28], it can be written:  
\[ \begin{array}{c}P_{12}(x)=p_{12}\cdot F_{12}(x)\\ P_{13}(x)=p_{13}\cdot F_{13}(x)\\ P_{14}(x)=p_{14}\cdot F_{14}(x)\\ P_{15}(x)=p_{15}\cdot F_{12}(x)+\ R_{1}(x)\\ \end{array}  \tag{12}\]  
where:  
\(F_{1j}(x),j=2,3,4,5\)--conditional distributions of the time spent in state 1, provided that the next state is state j, defined as follows [30; 31]  
\[F_{\bar{y}}(t)=P\{\tau_{k+1}-\tau_{k}<t|X(\tau_{k+1})=j,X(\tau_{k})=i\},\text {dla i},j=1,2,3,4,5 \tag{13}\]  
\(R_{1}(x)=1-F_{1}(x)\)--random variable reliability function \(T_{1}\). Additionally, in order to simplify further considerations, it has been assumed that the following equations are true  
\[F_{12}(x)=F_{13}(x)=F_{14}(x)=F_{15}(x)=F_{1}(x) \tag{14}\]  
Considering the above, the Criterion Function (10) is expressed by the formula  
\[ \begin{array}{c}g(x)=\frac{ET_{1}(x)\cdot Z_{1}+p_{12}\cdot F_{1}(x)\cdot ET _{2}\cdot z_{2}+p_{13}\cdot F_{1}(x)\cdot ET_{3}\cdot z_{3}+\left[\left(p_{13 }P_{4}+p_{14}\right)\cdot F_{1}(x)\right]\cdot ET_{4}+}{ET_{1}(x)+p_{12}\cdot F _{1}(x)\cdot ET_{2}+p_{13}\cdot F_{1}(x)\cdot ET_{3}+\left[\left(p_{13}P_{4} +p_{14}\right)\cdot F_{1}(x)\right]\cdot ET_{4}+}\\ \frac{+\left[1-\left(p_{12}+p_{13}+p_{14}\right)\cdot F_{1}(x)\right]\text{ ET}_{5}-z_{5}}{+\left[1-\left(p_{12}+p_{13}+p_{14}\right)\cdot F_{1}(x)\right] \cdot ET_{5}}\\ \end{array}