Optimal power flow (OPF), a mathematical programming problem extending power flow relationships, is one of the essential tools in the operation and control of power grids. To name but a few, the primary goals of OPF are to meet system demand at minimum production cost, minimum emission, and minimum voltage deviation. Being at the heart of power system problems for half a century, the OPF can be split into two significant categories, namely optimal active power flow (OAPF) and optimal reactive power flow (ORPF). The OPF is spontaneously a complicated non-linear and non-convex problem; however, it becomes more complex by considering different constraints and restrictions having to do with real power grids. Furthermore, power system operators in the modern-day power networks implement new limitations to the problem. Consequently, the OPF problem becomes more and more complex which can exacerbate the situation from mathematical and computational standpoints. Thus, it is crucially important to decipher the most appropriate methods to solve different types of OPF problems. Although a copious number of mathematical-based methods have been employed to handle the problem over the years, there exist some counterpoints, which prevent them from being a universal solver for different versions of the OPF problem. To address such issues, innovative alternatives, namely heuristic algorithms, have been introduced by many researchers. Inasmuch as these state-of-the-art algorithms show a significant degree of convenience in dealing with a variety of optimization problems irrespective of their complexities, they have been under the spotlight for more than a decade. This paper provides an extensive review of the latest applications of heuristic-based optimization algorithms so as to solve different versions of the OPF problem. In addition, a comprehensive review of the available methods from various dimensions is presented. Reviewing about 200 works is the most significant characteristic of this paper that adds significant value to its exhaustiveness.