The increasing data demand in recent years has resulted in a considerable rise in heterogeneous cellular network energy usage. Advances in heterogeneous cellular networks with renewable energy supplied from base stations offer the cellular communications sector interesting options. Rising energy consumption, fuelled by huge growth in user count as well as usage of data, has emerged as the most pressing challenge for operators in fulfilling cost-cutting and environmental-impact objectives. The use of minimum power relay stations or base stations in conventional microcells is intended to lower cellular network's total energy usage. We examine the reasons, difficulties, and techniques for addressing the energy cost reduction issue for such renewable heterogeneous networks in this paper. Because of the variety of renewable energy as well as mobile traffic, then the issue related to a reduction in energy cost necessitates both spatial and temporal resource allotment optimization. In this paper, we proposed a new technique for reducing the energy consumption cost using the optimal time constraint algorithmic approach. We demonstrate that the proposed method has time as well as space complexity. Experimental simulations on actual databases with synthetic costs are used to confirm the usefulness and efficacy of our method.