Regular assessments of events taking place around the globe can be a conduit for the development of new ideas, contributing to the research world. In this study, the authors present a new optimization algorithm named doctor and patient optimization (DPO). DPO is designed by simulating the process of treating patients by a physician. The treatment process has three phases, including vaccination, drug administration, and surgery. The efficiency of the proposed algorithm in solving optimization problems compared to eight other optimization algorithms on a benchmark standard test function with 23 objective functions is been evaluated. The results obtained from this comparison indicate the superiority and quality of DPO in solving optimization problems in various sciences. The proposed algorithm is successfully applied to solve the energy commitment problem for a power system supplied by a multiple energy carriers system.