All 13,000 taxis in New York City could be replaced by a fleet of 3,000 ride-sharing cars used for carpooling, according to research published today from MIT’s Computer Science and Artificial Intelligence Laboratory (CSAIL). Replacing all those taxis could significantly reduce traffic, pollution, fuel use, and lost time thanks to a more efficient use of transit resources.

Taking data from 3 million actual New York City taxi rides, the CSAIL researchers developed an algorithm that would allow 3,000 four-person vehicles (with riders sharing cars with others going to similar destinations) to meet 98 percent of taxi demand in the city with an average wait time of 2.7 minutes. Perhaps the most important part of the system is a dynamic repositioning of vehicles based on real-time demand, which makes the system 20 percent faster.

As both Uber and Lyft work to expand their carpooling businesses, the CSAIL team also looked at the potential for extreme carpooling. By examining other vehicle sizes, the team found that 2,000 10-person vehicles could meet 95 percent of demand, or the system could use a variety of vehicle types and reassign them based on incoming requests — perhaps by sending multi-passenger vans to a big sports event or concert rather than a larger fleet of smaller cars.

The system looks at all incoming requests and available vehicles and then determines the best routes and assignments for each car. After cars are assigned, the algorithm can then rebalance the remaining idle vehicles by sending them 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 Professor Daniela Rus who led the research. “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.”

To be sure, companies like Uber and Lyft are designing similar algorithms (though they’re probably considered trade secrets), but seeing it in action gives us an idea of how much cities could change once we have fleets of self-driving cars at our disposal. “The system is particularly suited to autonomous cars,” said Rus, “since it can continuously reroute vehicles based on real-time requests.”