## 5 Scheduling for General Systems
By examining the upper and lower bounds of \(\mu\) and \(\varpi\), we can decide \(Q\) and obtain the corresponding schedule. Note that the charging of \(CT_{q}\) is completed at time \(\tau_{q}=\tau_{0}+\varepsilon_{1}+\varepsilon_{2}+\ldots+\varepsilon_{q}\) if \(q<L\) and \(\tau_{q}=\tau_{0}+\varepsilon_{1}+\varepsilon_{2}+\ldots+\varepsilon_{q}+ \Omega_{Q}\) if \(q\geq L\). If \((\tau_{1}+\Omega_{q}+(1+\varpi_{q})\times\Psi)-\max\{\tau_{q},\,\tau_{1}+\Omega _{q}+\Psi\}\geq\Psi\) holds, \(CT_{q}\) can feed \(DS_{q}\) under the normal mode during \([\tau_{1}+\Omega_{q}+(1+\varpi_{q})\times\Psi,\,\tau_{2}]\), which further reduces \(\delta\). In the proposed scheduling method, the initial crude oil in the charging tanks should meet the given requirement. For charging tanks \(CT_{1-N}\), the lower bound can be easily satisfied as \(\sigma\) is not large and there is usually crude oil in the charging tanks initially in practice. If the volume of initial crude oil exceeds the upper bounds, the pipeline can be set as idle for some time such that a charging tank keeps feeding without being charged until the crude oil in it is less than the upper bounds. For charging tanks \(CT_{(N+1)-(2K-N)}\), the key is that the charging tank should be empty when the charging starts, which can be done if the pipeline is appropriately scheduled. By the proposed scheduling methods, it is assumed that each distiller processes one type of crude oil only during the entire scheduling horizon. In practice, a distiller has to switch from processing one type of crude oil to another, which is not considered to ease the presentation of the proposed results. If a distiller has to process a new type of crude oil under the SCF mode, the crude oil with a volume larger than the safety stock should be charged into an empty charging tank first to satisfy the SCF constraint. Then, this charging tank can be used to feed the distiller under the SCF mode after the charging tank that is previously feeding the distiller finishes its discharging. For a charging tank that feeds \(DS_{i}\), \(i\in\{N+1,\,N+2,\,\ldots,\,K\}\), under the normal mode, it is charged with volume \(\mu\times\alpha_{i}\) every time. However, in some circumstances, the distiller has to process a new type of crude oil after \(\varsigma<\mu\times\alpha_{i}\) of oil is processed. If \(\rho=1\) is not reached, an empty charging tank can be found and temporarily used for crude oil type switches. Then, the system is scheduled in the same way. Otherwise, it cannot be realized with the proposed method. In this case, we can use a charging tank in the system for oil type switches. Note that, as \(Q\) increases, \(\rho\) increases as well, resulting in \(\delta\) being reduced; this, however, makes it harder to find an empty tank for the new type of crude oil. Hence, it is important to choose a suitable \(Q\) for the schedule. It should be pointed out that, according to existing studies [21; 22; 27], three charging tanks for a distiller are generally required to find a feasible schedule with maximal production rate if only the normal mode is applied. Note that, in this paper, by carefully scheduling the system, we use two charging tanks for a distiller to realize the operation under the normal mode, and the SCF mode is adopted only when the number of charging tanks for a distiller is less than two. Thus, we minimize the number of charging tanks to find a schedule. When there are more charging tanks, a schedule can be more easily found. Furthermore, with the proposed method, the SCF mode is avoided if it is possible when there are not enough charging tanks to allow for finding a feasible schedule under the normal mode. Also,by the proposed method, a schedule can be found to realize a given refining schedule with simple calculation, and we generate the detailed schedule step by step. Hence, it provides an efficient way to solve the scheduling problem for a refinery without sufficient charging tanks.