An Isolated Microgrid (IMG) is an electrical distribution network combined with modern information technologies aiming at reducing costs and pollution to the environment. In this article, we implement the Bacterial Foraging Optimization Algorithm (BFOA) to optimize an IMG model, which includes renewable energy sources, such as wind and solar, as well as a conventional generation unit based on diesel fuel. Two novel versions of the BFOA were implemented and tested: Two-Swim Modified BFOA (TS-MBFOA), and Normalized TS-MBFOA (NTS-MBFOA). In a first experiment, the TS-MBFOA parameters were calibrated through a set of 87 independent runs. In a second experiment, 30 independent runs of both TS-MBFOA and NTS-MBFOA were conducted to compare their performance on minimizing the IMG using the best parameter tuning. Results showed that TS-MBFOA obtained better numerical solutions compared to NTS-MBFOA and LSHADE-CV, an Evolutionary Algorithm, found in the literature. However, the best solution found by NTS-MBFOA is better from a mechatronic point of view because it favors the lifetime of the IMG, resulting in economic savings in the long term.