Designing the master schedule for demand-adaptive transit systems