This study offers a general formulation for a class of fractional optimal control problems (FOCPs) where the performance index is expressed as a function of both control and state variables and the dynamic control system depends on Caputo fractional derivatives. The operational matrices of fractional Riemann-Liouville integration for Bernoulli polynomials and properties of Bernoulli polynomials are utilized to reduce the given optimization problems to the nonlinear programming problem (NLP) by solving of which we can approximate the optimal solution of FOCP. By implementing three metaheuristic approaches called multi-verse optimizer (MVO), moth-flame optimization (MFO), and whale optimization algorithm (WOA), the NLP is solved and the best approximation solution of FOCP is obtained. A survey on the superiority and the efficiency between these methods are considered by applying three numerical examples. Comprehensive analysis reveals that the MFO considerably solves these examples. Moreover, the profits and advantages of preference with its precision are demonstrated numerically. Simulation results obviously show that the objective functional value obtained by MFO effectively decreased on three illustrative examples in comparison with MVO and WOA.