Energy Optimization On Uav Assisted Communications By Machine Learning