We propose a new scheduling system using an automated guided vehicle (AGV) to improve the efficiency and safety of an unknown environment automated warehouses. In this paper, safety is determined by the probability of the collision between AGVs. In the AGV picking system, AGVs transport the entire shelves, which include the required products, to the depot stations. The system utilizes a genetic algorithm (GA) for task scheduling and Q-Learning algorithm for path planning. We add a Collision Index (CI), which calculates using AGVs' locations, to the GA's fitness function to increase safety. CI is based on the calculation of 2D density introduced in the Densitybased Spatial Clustering of Application with Noise (DBSCAN) theory. The simulations demonstrate the effectiveness of the CI to optimize not only time and overall efficiency but also the safety of an automated warehouse system.