# A New \"Doctor and Patient\" Optimization Algorithm: An Application to Energy Commitment Problem
## 3 Doctor and Patient Optimization (DPO)
### Implementation of DPO
\begin{table}
\begin{tabular}{r r r r r r r r r} \hline \hline Hour & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\ \hline
**Residential, Commercial, and Public** & 4609.373 & 4690.715 & 4582.259 & 4609.373 & 4744.943 & 5016.082 & 5422.792 & 6588.692 \\
**Industrial** & 2169.252 & 2207.533 & 2156.492 & 2169.252 & 2233.054 & 2360.657 & 2552.062 & 3100.755 \\
**Transportation** & 2931.142 & 2982.868 & 2913.9 & 2931.142 & 3017.352 & 3189.772 & 3448.402 & 4189.808 \\
**Agriculture** & 384.9789 & 3917.726 & 382.7143 & 384.9789 & 396.3018 & 418.9475 & 425.9163 & 550.2934 \\
**Other** & 2815.979 & 29.3438 & 28.64628 & 28.81579 & 296.6331 & 318.9853 & 33.9099 & 41.18962 \\
**Non-Energy** & 988.1946 & 1000.545 & 977.4111 & 983.1946 & 1012.112 & 1069.947 & 1156.7 & 1405.39 \\ \hline Hour & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ \hline
**Residential, Commercial, and Public** & 6886.946 & 7049.629 & 7239.427 & 7022.515 & 7022.515 & 6914.06 & 7103.857 & 7185.199 \\
**Industrial** & 3241.118 & 3317.68 & 3407.002 & 304.92 & 3304.92 & 3253.879 & 3343.201 & 3381.482 \\
**Transportation** & 4379.471 & 4482.923 & 4603.617 & 4465.681 & 4465.681 & 4396.713 & 4517.407 & 4569.133 \\
**Agriculture** & 575.2038 & 588.7913 & 604.6433 & 586.5257 & 586.5267 & 577.4683 & 593.3204 & 600.1142 \\
**Other** & 43.05417 & 44.0712 & 45.25773 & 43.9017 & 43.22368 & 44.41021 & 44.91872 \\
**Non-Energy** & 1469.008 & 1503.709 & 1544.194 & 1497.926 & 1497.926 & 1474.792 & 1515.276 & 1532.627 \\ \hline Hour & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \\ \hline
**Residential, Commercial, and Public** & 6914.06 & 6859.832 & 6778.49 & 6914.06 & 7049.629 & 6724.262 & 5965.071 & 4988.968 \\
**Industrial** & 3253.879 & 3228.358 & 3190.077 & 3253.879 & 3317.68 & 3164.556 & 2807.268 & 2347.897 \\
**Transportation** & 4396.713 & 4362.229 & 4310.503 & 4396.713 & 4482.923 & 4275.018 & 3793.242 & 3172.53 \\
**Agriculture** & 577.4683 & 572.9392 & 566.1454 & 577.4683 & 588.7913 & 561.6163 & 498.208 & 416.683 \\
**Other** & 43.22368 & 42.88467 & 42.37616 & 43.22368 & 44.0712 & 42.03715 & 37.29102 & 31.18885 \\
**Non-Energy** & 1474.792 & 1463.225 & 1445.874 & 1474.792 & 1503.709 & 1434.307 & 1272.369 & 1064.164 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Final energy consumption (barrels of oil equivalent (BOE)). #### 5.2.2 DPO Implementation to EC Problem

The purpose of implementing the EC problem is to supply energy demand by determining the most appropriate use of energy carriers, considering technical and economical constraints. In the study of each hour of the 24-h period the first step, after the required energy conversions, was to determine possible combinations of power plants based on the required electrical energy demand. Therefore, all possible combinations of power plants are determined for each hour of the study period. The second step involved determining a suitable pattern for energy carrier use for the entire study period, as well as the optimal combination of power plants for each hour, based on the objective function and using the proposed optimization algorithm. This convenient pattern of energy carrier usage is actually the main output of EC problem. The EC problem is coded in MATLAB and executed on a system with a quad-core 3.3 GHz processor and 8 GB of RAM. The pseudo code of EC problem solution using DPO is specified in Algorithm 2. #### 5.2.3 Results and Discussion

The proposed DPO algorithm was implemented on the power system in order to achieve optimal results in an economical manner for the introduced energy commitment problem. The purpose of this operation is to reduce operating costs in order to supply energy demand.