This paper provides a procedure for numerically solving optimization problems via indirect methods. To consistently generate good initial guess solutions, metaheuristic algorithms, that is, heuristic optimization algorithms with a natural metaphor, are used. These algorithms excel at arriving at close-to-optimal solutions to problems in the absence of a priori knowledge. The metaheuristic algorithms particle swarm optimization and the firefly algorithm are conventionally used for this purpose. This work exploits optimal foraging theory to modify the conventional firefly algorithm to incorporate the Lèvy flight foraging hypothesis. While most of the heuristic approaches rely on brownian motion based random search, the proposed algorithm utilizes the Lèvy distribution, a fat-tailed exponential probability distribution. These metaheurstics are used to bypass the difficulty of indirect methods by obtaining a good guess of the optimal solution which can then be used to initialize a two-point boundary value problem solver. To show the efficacy of this approach, three optimal control problems of varying difficulty are presented with the metaheuristic/indirect method approach successfully deriving the optimal solution in each case.