The adoption of smart grid technologies offers Gabon several opportunities to enhance energy efficiency and sustainability. This study investigates the use of optimum control algorithms to increase grid stability and enhance the utilization of renewable energy sources. Mathematical models and simulations are used to assess genetic algorithms in light of Gabon's unique energy situation. Systems known as electrical smart grids supply electricity to users directly from power plants in an effort to reduce costs, cut down on blackouts, and improve energy efficiency. Smart grids, or SGs, are well-known pieces of equipment because of their amazing capabilities, which include bi-directional communication, stability, power failure detection, and interconnectivity with appliances for monitoring. Many modern data and security management systems, including modeling, monitoring, optimization, and/or artificial intelligence, lead to SGs. Energy was once cheap, easily managed, and dependent only on fundamental elements. Demand has significantly increased as a result of the current circumstances, which has also increased Gabon's electricity expenses, the likelihood of a contingency, and the complexity of the electrical network. In Gabon, smart grids have shown to be the most practical and clever way to lessen these problems in recent years. An electrical network with information technology integrated is called a smart grid. According to this study, using genetic algorithms in a smart grid could lower Gabon's overall electricity prices. In order to meet demand, the proposed approach makes use of off-grid battery banks and renewable energy sources. The goal of GA optimization is the short-term time averaged power cost; factors that affect this include grid energy to satisfy load, battery discharge, and other factors. MATLAB software is used to solve the optimization problem over a 24-hour period of renewable input, real-time energy pricing, and load. The results are presented.