Open Mathemalsky opened 3 years ago
C++
has templates we could have one templated implementation which is exposed through a float and int helper function, i.e.
[...] AAL_KNAPSACK_EXACT([something with ints]);
[...] AAL_KNAPSACK_EXACTF([something with floats]);
static [...] AAL_KNAPSACK_EXACT_([something with templates]);
You can now have a look at the performance comparison. As suspected the pointer version is considerably faster than the initial version. In my test it took about 1.3 s
in contrast to the older version, which consumed > 6 s
.
So if you agree to that point than merge the performance improved version into master.
Do we need the performance test any more and should also merge into master?
Ok, the performance difference is indeed quite massive.
I merged the improved version now. I don't think we should merge the performance test right now. Maybe we could later do a performance test which compares every algorithm for a given problem.
I thought and read a bit about the knapsack problem.
FPTAS
version will invoke the exact knapsack problem on the rounded data.