# The Method of Production Scheduling with Uncertainties Using the Ants Colony Optimisation
## 2 Production and Maintenance Scheduling Model  
The scheduling problem in a job shop system where production tasks are allocated to resources with performance constraints due to maintenance is considered. Production systems are described by: (a) production tasks, (b) machines, (c) routes of production tasks, (d) operation times, (e) task completion dates. Production tasks are executed in exclusive-like mode and operations are not preempted. After a machine failure, the disrupted operations can be performed on parallel machines. Data on the failure-free operation of the machine is collected. Knowledge about the machine reliability characteristics for the future planning horizon is acquired in five stages:  
1. Adoption of the hypothesis that the time of failure-free operation is described by the reliability distribution depending on the phase of the machine's life cycle. 2. Application of methods for estimating distribution parameters. 3. Prediction of distribution parameters for the future planning period. 4. Calculation of the reliability characteristics (e.g., mean time to failure (MTTF)) for the future planning period. 5. Assessment of the impact of variable dates of failure on the values of stability and robustness criteria for given values of machine reliability characteristics. The analyzed historical period is divided into \(i\) equal scheduling periods, \([(i-1)T,iT)\), \(i=1,...,m+1\). For each of them, \(N_{i}\) events are observed, i.e., machine failures with failure-free times \(X_{i,1},...,X_{i,N_{i}}\). For each historical period \(i\), the distribution parameters are estimated in order to describe the phenomenon of failure rate. Let us assume the hypothesis that the failure-free times \(X_{i,1},...,X_{i,N_{i}}\) in period \(i\left[(i-1)T,iT)\right.\), \(i=1,...,m+1\) are described by the exponential distribution with parameter \(\mu_{i}>0\) with a density function:  
\[f_{i}(t)=\left\{ \begin{array}{c}\mu_{i}\exp(-\mu_{i}t),t>0,\\ 0,t\leq 0,\end{array} \right. \tag{1}\]  
Parameters \(\mu_{i}\) are estimated in the second stage. Values of \(\mu_{i}\) generally differ in subsequent historical periods \(i\). Using the maximum likelihood method, the parameter \(\widetilde{\mu_{1}}\) for the first period is estimated:  
\[\widetilde{\mu_{1}}=\frac{n_{1}}{\sum_{k=1}^{n_{1}}x_{1,k}} \tag{2}\]In the empirical moment method, value \(\widetilde{\mu_{1}}\) is determined comparing the equations:  
\[m_{1}(x_{1})=\frac{1}{n_{1}}\sum_{k=1}^{n_{1}}x_{1,k} \tag{3}\]  
where:  
\[m_{1}(x_{1})=\frac{1}{\mu_{1}} \tag{4}\]  
and the formula for the estimated parameter \(\widetilde{\mu_{1}}\) (2) is obtained. After obtaining the estimated values of the distribution parameters for each historical period, parameter \(\mu_{m+1}^{\sim}\) is predicted for the future planning period using classical regression technique. Defining the function describing the parameters consists in eliminating fluctuations and identifying trends of the analyzed data on failure-free times. The least squares method is used for smoothing time series in linear and quadratic functions. To confirm the hypothesis that the scatter plot of a given function is the most reliable, two coefficients are calculated: (a) coefficient of determination (R2) which measures the trend fit to the failure-free data and (b) the function of losses (SSE) which is the sum of squared deviations residues. The hypothesis with the function with the highest R2 value and the lowest SSE value is selected. In the fourth stage, we determine the reliability characteristics, such as [16]:  
* Mean Time Between Failures = Mean Time To Failure + Mean Time of Repair, (_MTBF_ = _MTTF_ + _MTTR_), \[MTBF=E\{X_{m+1,1}+Y_{m+1,1}\}=\frac{1}{\mu_{m+1}}+\frac{1}{\alpha_{m+1}},\] (5) where: \(\alpha_{m+1}>0\) is predefined.