The location of sensor nodes is necessarily predefined and not known. Such a feature allows us to release them in hazardous or inaccessible places. Another unique feature of sensor networks is the ability to collaborate and coordinate sensor nodes. Each node of the sensor has a processor on its board, and if it uses related algorithms, instead of sending all the raw data to the center, it first performs its initial and simple processing on them and then sends the semi-processed data. | International Journal of Computer Networks and Communications Security VOL. 5, NO. 9, SEPTEMBER 2017, 188–197 Available online at: E-ISSN 2308-9830 (Online) / ISSN 2410-0595 (Print) Improve the Routing Algorithm in Wireless Sensor Networks Using a Reinforcement Learning Strategy Shadi Zeinali1 and Mohsen Davoudi-Monfared2 1 2, 3 Department of Computer Sciences, Islamic Azad University, Tafresh Branch, Tafresh, Iran Department of Mathematics and Computer Sciences, Islamic Azad University, Tafresh Branch, Tafresh, Iran 1 , 2davoudi60@, 3davoudi@ ABSTRACT Recent developments in the field of electronic and wireless communications have the ability to design and manufacture sensors with low power consumption, small size, reasonable prices and various data uses. These small sensors, which have the ability to perform actions such as receiving various environmental information based on the sensor type, processing and sending it, monitoring and monitoring, etc., have led to the emergence of ideas for the creation and expansion of networks known as wireless sensor networks. A sensor network consists of a large number of sensor nodes that are widely distributed in an environment that collects information from the environment. The location of sensor nodes is necessarily predefined and not known. Such a feature allows us to release them in hazardous or inaccessible places. Another unique feature of sensor networks is the ability to collaborate and coordinate sensor nodes. Each node of the sensor has a processor on its board, and if it uses related algorithms, instead of sending all the raw data to the center, it first performs its initial and simple processing on them and then sends the semi-processed data. Keywords: Wireless Sensor Networks, Clustering, Clustering, Energy Balance, Lifetime. 1 INTRODUCTION Network sensor [1] is a network consisting of a large number of small nodes operating autonomously to gather