All 13,000 taxis in New York City could be replaced by a fleet of 3,000 ride-sharing cars if used exclusively for carpooling, according to research published today by MIT’s Computer Science and Artificial Intelligence Laboratory (CSAIL). Instead of hailing taxis, passengers that use ride-sharing services for carpooling may lead to reduced traffic congestion, pollution, and fuel use.

The CSAIL researchers used public data from NYC taxi rides published by the University of Illinois to develop the algorithm. They calculated that 3,000 four-person vehicles traveling to similar destinations could 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.”