• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Railway Transportation Route Information Application

 
Ranch Hand
Posts: 391
1
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was on this site Delhi metro Rail where you can find out complete route of your journey in Delhi metro .

Just select source and destination stations and it will present list of route points that will come in your journey.
And it also tells you the fare if you stop in between .
So fare is given from one station to next station that will land in your journey.

They also tell you where you have to change metro.

Now how they do it , I can`t imagine it will be static.
Like choose your source and destination and it will serve the route that is already present in database .

Can anybody explain how to map this kind of problem on programming surface.
 
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This might be a fun project to implement if you want to get your hands dirty with a graph DB like neo4j. The stations would be nodes, and they would have a relationship to every other station to which you can get via any particular line. So you would start by finding the two nodes - if they are both located in the same line, it should be easy to work your way through the graph to get form one to other. While doing that you'd count the number of stops (or pick up any other information needed to calculate the fare and the time of travel). If both stations are not on the same line it gets a bit trickier - you would need to find stations where two lines intersect, one of which is also on the starting point, and one of which is also on the end point. There could be several such stations, and you would need an algorithm to choose one (maybe based on shortest travel time, or lowest fare). If a single change is insufficient t(i.e, there are no stops where two lines meet that serve start and end point) it gets trickier still. But not unsurmountably so :-)

This is an interesting optimization problem, as there are various complications you could (or would need to) take into account: a) Construction might close a station, either so that trains don't stop there, or so that lines are effectively cut in half (no through trains). b) Fares might not always depend just on the number of stops - e.g., some outlying stations might be more expensive to get to than more centrally located ones (that is the case in my local system). c) there might be different modes of transportation - buses in addition to metro, and the fare for them might differ (my local system counts 6 bus stops the same as 3 metro stops).
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:This might be a fun project to implement...


@Mahtab - As Ulf says: A fun project, but NOT simple.

So:

1. You might want to think about whether you're quite ready for it just yet. Challenging yourself is a good thing, but if you pick something that's too advanced you can wind up simply getting frustrated .
I'd need to put my thinking cap on big time for a project like this; and I've been at this game a long time.

And even if you aren't quite ready right now, that's not to say you won't be in a few months time...

2. It's worth doing a lot of background reading before you try to tackle a problem like this. For example: this page, which has other related links.

3. If/when you do decide to tackle it: start simple. Specifically: DON'T start by trying to emulate the entire Delhi network. Try it out with maybe a couple of intersecting lines first; make sure it works - every time - before you move on; and develop incrementally.

HIH

Winston
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow, what an interesting project!

You are going to learn a lot because there are many approaches to optimization of routes and a long history.

Heed Winston's advice to start with simple examples.

See this wikipedia entry for some history of the "traveling salesman" problem.

Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic