Coach Problem or Shortest - Path Problem or Traveling Salesman Problem
Coach Problem or Shortest - Path Problem or Traveling Salesman Problem
Objective:- To find the shortest distance and the corresponding path from a given source node to
given destination node.
Solution:- to solve the shortest -path problem first we need to define problem stage , decision
variables , state variables return function , transition function.
Decision variables(dn):- these are the variables that define the immediate destination when there are ‘n’ stages to
go.
Return function(Fn(Sn,dn):-this function calculates the minimum total distance for the last ‘n’ stages.
Transition function:- this function define how the state varibles changes as the problems progresses from one
stages to another.
Minimum distance (F*n(Sn)):-optimal path (minimum distance) when the salesman is in state Sn with n more
stages to go for reaching the final stage(destination)
To solve this problem we start calculating distance between a pair of cities from destination city and work backwards
to find the optimal path.
The recursion relationship for this problem can be stated as follows
Example:-
We are follow something called as backword recursive approach.
8 7 7 10
9 9 9 10
n=2 two more stage to go
Now move backword to stage 3,we have three states s2=5,s2=6,s2=7
Here we have two decision variable d2=8,d2=9
For this we have to evaluates two sums:
D(5,8 )+f*1(8)=4+7=11
D(5,9) +f*1(9)=8+9=17
Take minimum of two
F2(5)=Min{11,17}=11.
Similarly for s2=6,s2=7
F2(6)=Min{D(6,8)+f*1(8)=3+7=10,D(6,9)+f*1(9)=7+9=16}=10
F2(7)=Min{D(7,8)+f*1(8)=8+7=15,D(7,9)+f*1(9)=4+9=13}=13
States(s2) F2(s2,d2)=Ds2,d2(d2=8) F2(s2,d2)=Ds2,d2(d2=8) Minimum distance(f*2(s2)) Optimal decision(d2)
5 11 17 11 8
6 10 16 10 8
7 15 13 13 9
n=3 three more stage to go
2 18 20 18 18 5 or 7
3 14 18 17 14 5
4 17 20 18 17 5
n=4 four more stage to go
1 22 20 20 20 3 or 4
From the above, it is clear that there are two{(1,3,5,8,10) or (1,4,5,8,10)} alternative shortest routes for this problem,
both having a minimum distance of 20.