An efficient algorithm for energy harvesting in IIoT based on machine learning and swarm intelligence