Flexible and Scalable Routing Approach for Mobile Ad Hoc Networks by Function Approximation of Q-Learning