Phased replacement of bus lines by rail in a transit network with passenger flow modeling