Optimization and Discrete Choice in Urban Systems