A Simple FPTAS for Constrained Shortest Path - fmi.uni

A Simple FPTAS for Constrained Shortest Path
Abstract
In this short note we describe a very simple FPTAS for the constrained shortest path problem in a directed
graph G(V, E) with a running time of O(|E||V |(log log |V | + 1/ε).
1
Introduction
We consider the following classical resource constrained shortest path problem: Given a graph G(V, E), functions
c : E → N+ (cost) and r : E → R+ (resource), source andX
target vertices s andX
t, we are interested in computing a
path π = v0 v1 . . . vk with v0 = s, vk = t which minimizes
c(e) and satisfies
r(e) ≤ R.
e∈π
e∈π
A standard dynamic programming approach computes an optimum solution to this problem in time O(|E|copt )
by filling out a matrix with n = |V | columns row by row. Assuming that we are looking for a path from node 1 to
node n, the matrix cell rk,j in column j and row k contains the minimum resource consumption of a path from 1 to
j which has cost at most k. By considering the path that realizes this value and in particular its next-to-last node,
the following reccurrence is easily shown to be correct: rk,j = min Ck−c(e),i + r(e). As determining the value of
e=(i,j)
Ck,j only requires the lookup of cells further up, we can indeed fill the matrix row-by-row from top to bottom. We
are finished as soon as a value less or equal to R shows up in the last column. This will happen in row copt (cost of
the optimal path satisfying the constraint). Filling in one row can be done in time O(|E| + |V |) = O(|E|) as each
edge of the graph is considered once in the process. So the overall running time for solving the problem exactly is
O(|E|copt ). This algorithm is only quasi-polynomial since copt might be superpolynomial in the encoding length of
the problem instance.
2
2.1
Scaling and Search for the Right Scaling Factor
Standard Scaling
A standard approach to reduce the running time of the dynamic program is to scale and round the edge costs by
a factor S, that is, c0 (e) := dc(e)/Se
and solve for the ’scaled down’ problem. Let πopt be the optimal path for the
P
given CSP instance, copt = e∈πopt c(e) its cost. Furthermore let πscal be the optimal path for the scaled down
P
CSP instance, cscal = e∈πscal c(e) its cost. Note that cscal ≤ copt /S + n, hence the running time for solving the
scaled down version using dynamic programming is O(|E|(copt /S + n)).
In the following we will assess the quality of the optimum path for the scaled down version in terms of the
original problem instance. We are interested in the cost ctrans of πscal (which is what our approximation algorithm
will return) under the unscaled edge costs:
X
X
X
X
dc(e)/Se ≤ S ·
dc(e)/Se ≤ S ·
((c(e)/S) + 1)
ctrans =
c(e) ≤ S · cscal = S ·
e∈πscal
e∈πscal
e∈πopt
e∈πopt
≤ copt + Sn = copt (1 + Sn/copt )
The second inequality holds since πscal is the optimal path under the scaled down edge costs. If we are after a
(1 + ε) approximate solution we simply choose a scaling factor of S ∗ = εcopt /n. Here the problem is that we do
not know copt when we have to choose the scaling factor; in the very similar case of the (1 − ε)-approximation for
knapsack, a simple 2-approximation suffices to get an idea about the magnitude of copt . In our case we have to
work a bit harder to get a constant approximation.
1
2.2
Search for S ∗
First observe that we can easily assume in the following that copt ≥ 2n/ε by filling in the original dynamic
programming matrix up to row 2n/ε. If in the last column a value of less than R has appeared, we have found the
optimum solution in time O(mn/ε), otherwise copt ≥ 2n/ε.
Also note, that if we can find a scaling factor S 0 which results in an objective function value cscal of the scaled
down problem instance with 2n ≤ cscal we have determined a constant approximation to copt . This follows from
the fact that cscal ∗ S − n ≤ copt ≤ cscal ∗ S and
n
n
4
cscal S
=1+
=1+
≤ .
cscal S − n
cscal S − n
cscal + n
3
Note, though, that we are not interested in scaling factors which lead to a too large objective function value of
the scaled down version as the running time to solve this instance is O(|E|cscal ). More concretely we better find a
scaling factor which leads to a obj. function value at least 2n but O(n), e.g. between 2n and 3n.
In the following we will try to find a scaling factor which brings the objective function value of the scaled down
instance into that range. Consider the edges of G ordered according to their cost, e1 , e2 , . . . em with c(ei ) ≤ c(ei+1 ).
Let G(i) (V, E (i) ) be the graph induced by the first i edges, that is, E (i) = {e1 , e2 , . . . ei } and unit costs on the
edges (the surviving edges bear the original resource consumption). We can determine by binary search in time
0
O((n log n + m) log m) the smallest i0 such that in G(i ) there is a path with resource consumption at most R from
s to t. We know that for a scaling factor of c(ei0 )/k, the cost of a path with resource consumption at most R from
s to t is at least k since amongst the edges of the respective path, there must be one which has cost at least k (if all
edges had cost k 00 < k, this would contradict the choice of i0 ). Considering the two scaling factors S0 := c(ei0 ) and
S1 := c(ei0 )/3n we know that for the former, the objective function value ist at most n, and for the latter it is at
least 3n but at most 3n2 . Consider the k = O(log n) scaling factors S1 , 2S1 , 4S1 , 8S1 , . . . 2k S1 . First, it is clear that
the objective function value between two consecutive scaling factors differs by at most a factor of 2. Binary search
on the O(log n) scaling factors yields a scaling factor as desired in O(log log n) iterations. Evaluating whether a
given scaling factor leads to a objective function value ’around’ n has cost O(mn), hence the overall running time
of this approach is O(mn log log n).
Armed with this constant approximation to the optimum solution, we can compute in another O(mn/ε) steps
an (1+ε)-approximation to the original problem instance. Hence the overall running time is O(mn(1/ε+log log n)).
Interesting open questions:
• if we could obtain a log n-approximation in O(mn) time, we would immediately improve the overall running
time to a spectacular O(mn(1/ε+log log log n)), a constant approximation would give us the desired O(mn/ε)
• the partition of the range of scaling factors S0 , . . . S1 does not take into account at all the objective function
values at the respective scaling factors – maybe that helps ...
2