Cloud data center comprises various physical and virtual machines, alongside storage datacenter services provided by cloud providers. Effectively mapping tasks to optimize resource utilization and load balance is essential for efficient task scheduling. This process, referred to as scheduling constraints, can significantly enhance overall efficiency. However, to harness the benefits of this scheduling, one must address the challenges arising during task execution. The interdependencies between tasks and the diverse resources available in the datacenter pose significant hurdles to efficient resource allocation. To address these challenges, this paper introduces the Hybrid HEFT-PSO-GA algorithm (HEPGA), aiming to efficiently allocate tasks to available resources across the datacenter. The HEPGA algorithm builds upon prior research by integrating the strengths of PSO (Particle Swarm Optimization) and GA (Genetic Algorithm) to optimize task scheduling in cloud computing environments. Through the fusion of PSO, GA, and HEFT-based Initialization, the algorithm strives to efficiently allocate tasks to processors, thereby minimizing the makespan. This approach capitalizes on parallel processing capabilities to further enhance resource utilization in the cloud environment. By varying the weights of the fitness function and considering the resources within the datacenter, we meticulously analyze the algorithm's performance concerning both makespan and Resource Utilization (RU). The results of these tests underscore the algorithm's consistent and robust resource utilization across diverse weight configurations, highlighting its adaptability to varying priorities. Moreover, the observed variations in makespan performance based on different weights emphasize the algorithm's potential for excellence when tailored to specific optimization goals.