SAN FRANCISCO—MIT believes they may have found a solution for city traffic jams nationwide. A 2015 study ranked San Francisco the number three in the Top 10 Cities With The Worst Traffic In America. New York placed second behind San Francisco and Washington D.C.’s 75 hours spent in traffic on average in 2015. Los Angeles took the number one spot at 81 hours.

Lyft and Uber are estimated to have 45,000 drivers on San Francisco streets, with over 2,026 taxi medallions in the city. A study conducted by MIT’s Computer Science and Artificial Intelligence Laboratory claims to have found a way to cut traffic by 75 percent.

Researchers, led by MIT Professor and Head of the Computer Science and Artificial Intelligence Lab Daniela Rus, designed an algorithm to figure out how small a number of ride-share cars are needed to clear traffic but still be effective.

The system graphs all of the vehicle requests and all physical vehicles. A second graph is created displaying as many trip combinations as possible. The system applies the method known as “integer linear programming,” to connect each vehicle to the best trip combination.  The algorithm redirects the remaining idle vehicles to higher-demand areas.

“A key challenge was to develop a real-time solution that considers the thousands of vehicles and requests at once,” says Rus. “We can do this in our method because that first step enables us to understand and abstract the road network at a fine level of detail.”

The final product is what Rus calls an “anytime optimal algorithm,” which means the more the design is used, the more it improves itself.

When applied to New York traffic, it was concluded that in 3,000 four-seater vehicles could be just as effective as 98 percent of New York taxis.

In San Francisco, MIT’s algorithm translates to only about 430 app-hailed cars. The algorithm has not yet been presented to ride-share companies like Lyft or Uber.