Enhancing Energy Efficiency in WSNs with AI-Driven Routing