Owning to the inconsistency distribution of computing and storage resources in the cloud computing heterogeneous environment, and easily leading to the low scheduling efficiency and load unbalance when using the traditional scheduling algorithm to allocate the resource. Firstly, the scheduling model based on main-minor structure is introduced and the goal function is defined by considering the finishing time of computing, network bandwidth and delay, then the initial allocation method based on Q-learning is designed, and the Q value from the optimal strategy is used to initialize the Q value of the nodes in the network. Finally, the double orientation ACO algorithm based on front ant and back ant is proposed to realize the resource allocation, and the algorithm is defined and described. The simulation experiment in the CloudSim environment, and the result shows the method in this paper can realize the task-resource allocation, and compared with the other methods, it has the advantage of accurate predicting time and high load balance, therefore, it is an effective resource allocating method for cloud computing heterogeneous environment.