An Intelligence-Based Recurrent Learning Scheme for Optimal Channel Allocation and Selection in Device-to-Device Communications