This paper presents a novel improved firefly algorithm (IFA) to deal the problem of the optimal operation of thermal generating units (OOTGU) with the purpose of reducing the total electricity generation fuel cost. The proposed IFA is developed based on combining three improvements. The first is to be based on the radius between two solutions, the second is updated step size for each considered solution based on different new equations, and the third is to slightly modify a formula producing new solutions by using normally distributed random numbers and canceling uniform random numbers of conventional firefly algorithm (FA). The effect of each proposed improvement on IFA is investigated by executing five benchmark functions and two different systems. The performance of IFA is investigated on six other study cases consisting of different types of objective function and complex level of constraints. The objective function considers single fuel with quadratic form and nonconvex form, and multifuels with the sum of several quadratic and nonconvex functions while a set of constraints taken into account are power loss, prohibited zone, ramp rate limit, spinning reserve, and all constraints in transmission power networks. The obtained results indicate the proposed improvements in terms of high optimal solution quality, stabilization of search ability, and fast convergence compared with FA. In addition, the comparisons with other methods also lead to a conclusion that the proposed method is a very promising optimization tool for systems with quadratic fuel cost function and with complicated constraints.