This paper introduces a new Firefly Algorithm (FA) for multimodal optimization, comparing it with other metaheuristic algorithms such as particle swarm optimization (PSO). The FA is inspired by the behavior of fireflies, where attractiveness is proportional to brightness, which in turn is related to the objective function. The algorithm's performance is evaluated through simulations, demonstrating its superiority over PSO and genetic algorithms (GA) in terms of efficiency and success rate. The FA is particularly effective in finding both global and local optima simultaneously, making it suitable for solving NP-hard problems. The paper also discusses the implementation details, including the formulation of attractiveness and distance, and provides a detailed comparison with PSO and GA using various test functions. The results show that the FA can achieve higher success rates and faster convergence, making it a promising tool for optimization tasks. Future research directions include improving solution quality and convergence, as well as extending the FA to multiobjective optimization problems.This paper introduces a new Firefly Algorithm (FA) for multimodal optimization, comparing it with other metaheuristic algorithms such as particle swarm optimization (PSO). The FA is inspired by the behavior of fireflies, where attractiveness is proportional to brightness, which in turn is related to the objective function. The algorithm's performance is evaluated through simulations, demonstrating its superiority over PSO and genetic algorithms (GA) in terms of efficiency and success rate. The FA is particularly effective in finding both global and local optima simultaneously, making it suitable for solving NP-hard problems. The paper also discusses the implementation details, including the formulation of attractiveness and distance, and provides a detailed comparison with PSO and GA using various test functions. The results show that the FA can achieve higher success rates and faster convergence, making it a promising tool for optimization tasks. Future research directions include improving solution quality and convergence, as well as extending the FA to multiobjective optimization problems.