In the presence of multiple non-regenerative relays, we derived optimal joint power allocation, relay selection, and subchannel pairing schemes in orthogonal frequency division multiplexing(OFDM) based wireless networks.The Lagrange dual method was employed to design the optimal algorithm.First, the optimization problem was formulated for the single-relay system and the optimal centralized algorithm was presented by resolving the dual problem.Next, the optimal algorithm for a multi-relay system was proposed in a similar way.Compared with the exhaustive search method, the computational complexity of the proposed optimal algorithms was reduced from non-polynomial to polynomial time.Finally, the centralized algorithm was extended to the distributed algorithm, which was more feasible for the practical system.Simulation results verify our analysis.