Energy management in datacenters is a major challenge today due to the environmental and economic impact of increasing energy consumption. Efficient placement of virtual machines in physical machines within modern datacenters is crucial for their effective management. In this context, five algorithms named CNN-GA, CNN-greedy, CNN-ABC, CNN-ACO and CNN-PSO, have been developed to minimize hosts’ power consumption and ensure service quality with relatively low response times. We propose a comparative approach between the developed algorithms and other existing methods for virtual machine placement. The algorithms use optimization algorithms combined with Convolutional Neural Networks to build predictive models of virtual machine placement. The models were evaluated based on their accuracy and complexity to select the optimal solution. The necessary data is collected using the CloudSim Plus simulator, and the prediction results were used to allocate virtual machines according to the predictions of the models. The main objective of this research is to optimize the management of Information Technology resources within datacenters. This is achieved by seeking a virtual machine placement policy that minimizes hosts’ power consumption and ensures an appropriate level of service for users' needs. It considers the imperatives of sustainability, performance, and availability by reducing energy consumption and response times. We studied six scenarios under specific constraints to determine the best model for virtual machines’ placement. This approach aims to address current challenges in energy management and operational efficiency.