The Money Changing Problem Revisited - Universität Bielefeld
The Money Changing Problem Revisited - Universität Bielefeld
The Money Changing Problem Revisited - Universität Bielefeld
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
972 Sebastian Böcker and Zsuzsanna Lipták<br />
6 Computational Results<br />
We generated 12 000 random instances of MCP, with k =5, 10, 20 and 10 3 ≤<br />
a i ≤ 10 7 . We have plotted the runtime of the optimized Round Robin Algorithm<br />
against a 1 in Figure 3. As expected, the runtime of the algorithm is mostly<br />
independent of the structure of the underlying instance. <strong>The</strong> processor cache, on<br />
the contrary, is responsible for major runtime differences. <strong>The</strong> left plot contains<br />
only those instances with a 1 ≤ 10 6 ; here, the residue table of size a 1 appears<br />
to fit into the processor cache. <strong>The</strong> right plot contains all random instances; for<br />
a 1 > 10 6 , the residue table has to be stored in main memory.<br />
6<br />
RoundRobin<br />
200<br />
RoundRobin<br />
5<br />
Nijenhuis<br />
k=20<br />
Nijenhuis<br />
k=20<br />
4<br />
k=10<br />
150<br />
time [sec]<br />
k=5<br />
3<br />
time [sec]<br />
k=10<br />
100<br />
2<br />
k=5<br />
50<br />
k=20<br />
1<br />
k=20<br />
k=10<br />
k=10<br />
k=5<br />
k=5<br />
0<br />
0 2*10 5 4*10 5 6*10 5 8*10 5 1*10 6 0<br />
0 2*10 6 4*10 6 6*10 6 8*10 6 1*10 7<br />
Fig. 3. Runtime vs. a 1 for k =5, 10, 20 where a 1 ≤ 10 6 (left) and a 1 ≤ 10 7 (right)<br />
To compare runtimes of the Round Robin Algorithm with those of Nijenhuis’<br />
algorithm [14], we re-implemented the latter in C++ using a binary heap as<br />
the priority queue. As one can see in Figure 3, the speedup of our optimized<br />
algorithm is about 10-fold for a 1 ≤ 10 6 , and more than threefold otherwise.<br />
Regarding Kannan’s algorithm [11], the runtime factor k kk > 10 2184 for k =5<br />
makes it impossible to use this approach.<br />
Comparing the original Round Robin Algorithm with the optimized version,<br />
the achieved speedup was 1.67-fold on average (data not shown).<br />
We also tested our algorithm on some instances of the <strong>Money</strong> <strong>Changing</strong><br />
<strong>Problem</strong> that are known to be “hard”: Twenty-five examples with 5 ≤ k ≤ 10<br />
and 3719 ≤ a 1 ≤ 48709 were taken from [2], along with runtimes given there<br />
for standard linear programming based branch-and-bound search. <strong>The</strong> runtime<br />
of the optimized Round Robin Algorithm (900 MHz UltraSparc III processor,<br />
C++) for every instance is below 10 ms, see Table 1. Note that in [2], Aardal and<br />
Lenstra do not compute the Frobenius number g but only verify that g cannot<br />
be decomposed. In contrast, the Round Robin Algorithm computes the residue<br />
table of the instance, which in turn allows to answer all subsequent questions<br />
whether some n is decomposable, in constant time. Still and all, runtimes usually<br />
compare well to those of [2] and clearly outperform LP-based branch-and-bound<br />
search (all runtimes above 9000 ms), taking into account the threefold processor<br />
power running the Round Robin Algorithm.