Professional Documents
Culture Documents
lij wixi y
xi = 0 or 1, lij
4. Dynamic Programming
Solution to the problem can be viewed as the result of a sequence of decisions.
For Example: Knapsack Problem
We have to decide the values of xi
Here first take the decision on x1 and x2 and then x3 ..
5. Cost function for multistage graph problem using forward approach.
Bcost(2,j)=c(1,j) if <1,j> E
7. All pair shortest path problem
Let G=(V,E) Directed graph with n vertices.
Cost Cost Adjacency Matrix, such that cost(i,i) = 0, 1i n
cost(i,j) cost of edge <i,j>
cost(i,j) = if i j and <i,j> not in E(G)
All pair shortest path problem to determine matrix A, in which A(i,j) is
the length of the shortest path from i to j.
P level(a ) Q (level(E ) 1)
i
n 1
n 0
The TSP can be modeled as a graph, such that cities are the graphs
vertices, paths are the graphs edges, and a path's distance is the edge's
length.
TSP tour is a cycle in a directed graph which visits each vertex exactly
once and also returns to the starting vertex.
Every tour consist of an edge <1,k> for some k in V- { 1 } and a path from
vertex k to 1.