Joint power and bandwidth allocation with relay selection is investigated for multi source multi relay amplify and forward cooperative communication system. The problem at hands is mixed integer optimization problem, which is computationally intensive to solve using exhaustive search. In this sense, particle swarm optimization (PSO) is used to solve the formulated problem without the need for the convexity and differentiability of the objective function, nor the relaxation of the integer variables, which are associated with conventional optimization techniques. Joint power and bandwidth allocation is proposed based on maximizing the sum rate of all users. The data rate achieved using AF is not a jointly-concave function in the power and bandwidth profiles. Frequency division multiplexing (FDM) is used based on the optimal power and bandwidth allocation; part of the data is transmitted using the relay, and the other part is transmitted using the direct link. A distributed implementation of the resource allocation problem is proposed based on the formulated fitness function. Numerical results demonstrate the effectiveness of the proposed allocation method.