In this paper two conventional random search methods that are Genetic Algorithm and Immune Genetic Algorithm has been compared in optimal power flow problem in power system. The IEEE 14-bus test system has been selected as case study. This comparison has been done in equal conditions for two algorithms. Objective function in this problem is the minimization of cost of network losses and the cost of reactive power injection in the period of five years. Control variables are voltage magnitude of generator buses, active power of generators and reactive power injection of load buses. The results show that the IGA is more accurate than the GA and global optimal solutions can be found by the IGA.