You need to design a software to control traffic lights at a junction where traffic are coming from four sides. It should follow basic traffic rules, allow a pedestrian to cross the road, and traffic to pass in reasonable time. How do you optimize the waiting time with respect to high traffic from one direction e.g. during morning and evening rush hours?