Modeling, simulation, and optimization of traffic intersections using petri nets