The determination of a generation unit's locational marginal price (LMP), which depends on our understanding of transmission line capacity and optimal power flow (OPF) based on reality, is crucial to evaluating the performance of the unit and determining its profit. Minimising the total cost of the generators will lower the price of electricity on the market. Since power flow equations are nonlinear, numerical and repetition-based approaches should be used to solve them. The equations in this paper are solved using a Moth Flame Optimization (MFO), and to enhance the performance of the MFO in its structure, for simultaneous calculations of power passing through in transmission lines so that by learning about the capacity of transmission lines, in addition to the optimal power flow becoming a reality, the price of electricity is determined using uniform market pricing, or LMP method. The FACTS device used for the problem is Static Var Compensator (SVC). Finally, values for bus voltages, line losses, power injected to buses, power travelling via lines, total generating costs, and generator profits would be included in the output of the proposed MFO algorithm. Additionally, the results of testing the proposed methodology on the IEEE 30-BUS network reveal improvements on the OPF problem.