In recent years, cloud computing has become more popular because of advancements in virtualization technology. By increasing the number of servers in cloud computing environment, cloud data centers have expanded and consumed much energy. Virtual machine consolidation is a solution for energy management in cloud environment. On the other hand, by increasing resource utilization in virtual machine consolidation, service level agreement assurance is difficult to obtain. Two main challenges in virtual machine consolidation are timely detection of overloaded servers and proper immigrant virtual machine selection from detected servers. In this paper, a new model is proposed based on MAPE-k loop for autonomous virtual machine selection. The presented model uses a proposed ensemble prediction algorithm in the analysis phase. Also, in the planning phase, a new multi-heuristics algorithm with flexible weights using learning automata is proposed. The effectiveness of the proposed model is evaluated by CloudSim simulator under real workload as compared with well-known algorithms in this domain. The experimental results indicate that, the proposed approach has averagely improved the balance between service level agreement violations, energy and migration counts by 47.39% compared to other methods.