Ad Hoc networks do not depend on infrastructure, this makes each node participating in the routes by forwarding information to the different neighboring nodes and grants autonomy and flexibility to the network. The instability of the wireless network is a problem that affects the Quality of Service (QoS) parameters due to the mobility of the nodes. This article uses an unsupervised learning algorithm and a reinforcement learning algorithm, for the self-configuration of an ad hoc network based on QoS parameters, with a hierarchical network topology that allows its segmentation into clusters, reducing the routing tables. The results show that the use of artificial intelligence algorithms allows the network to remain stable and to improve the conditions around the network management strategy, modifying in realtime the waiting time of the active route and the hello-interval in the AODV protocol. The experiments with the two intelligent algorithms allow analyzing the QoS parameters in each node of the ad hoc wireless network, using the end-to-end delay data of each node, and a dataset of the traffic sent from the entire topology for searching the nodes that require auto-configuration.