An obstacle in managing economic dispatch is the integration of diverse factors such as pollution and heat. By introducing the price penalty coefficient, this class of two-objective problems is transformable to a single-objective form. The formulation considers various practical constraints of the system, including non-smooth cost functions, the balance of production, demand, and losses, and the limitation of power generation by active generators. One of the fundamental difficulties in tackling these types of complex problems lies in the algorithms and solvers employed to identify optimal solutions for a range of operation problems. The rain optimization algorithm (ROA) has been utilized in this paper. ROA is derived from the inherent tendency of raindrops to seek out the lowest areas on the earth's surface. This algorithm possesses exceptional efficacy in resolving problems characterized by stringent constraints and is adept at circumventing local optima. To validate the proposed method for cost and emission reduction, the scheme under consideration has been developed using software on standard systems. The implementation of the scenarios has revealed that the limits of the power system have led to a decrease in the overall generation cost of fossil fuel generation units. In this article, the ROA algorithm managed to plan the production with an optimal cost of 38481.54 dollars in case 1, which obtained a more optimal value than all the compared algorithms. This reduction in cost is considered one of the triumphs of the optimization problems. The results showcased and juxtaposed in the software simulation verify the effective performance of the suggested approach in comparison to prior research.