KnapsackDivideAndConquerSolver #2507
Replies: 5 comments 6 replies
-
IN your PR, you should add that this is an approximate approach that does not guarantee optimality. |
Beta Was this translation helpful? Give feedback.
-
The algorithm is not exact. It returns a good but not optimal solution.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le jeu. 15 avr. 2021 à 15:27, ruqzuq ***@***.***> a écrit :
… I am unclear how you mean this. Does it refer to the algorithm or the
implementation?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2507 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3IYLFEWCWEOYTSKVLTTI3STVANCNFSM427KQ6RA>
.
|
Beta Was this translation helpful? Give feedback.
-
back to basics.
Knapsack is NP-Hard
you cannot solve it exactly with a polynomial algorithm.
You can also look at:
https://link.springer.com/content/pdf/10.1007/s10878-020-00584-2.pdf
The abstract clearly states that the algorithm is not exact.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le jeu. 15 avr. 2021 à 16:41, ruqzuq ***@***.***> a écrit :
… My naming is bad. There are approximation schemes that are so named. The
real name of DP-2 with storage reduction is RECURSIVE-DP. But the name does
not matter for me, I took DivideAndConquerSolver as a placeholder, because
it describes the procedure. You can name it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2507 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3IBASKRHKEYLTRRYNLTI33LFANCNFSM427KQ6RA>
.
|
Beta Was this translation helpful? Give feedback.
-
Excusez-moi. I have provided the necessary details for a factual discussion. I am willing to explain all the details. Nevertheless, I cannot deal with misinformation. If there is no interest in external volunteer involvement, I respect that and leave the project in silence. I compared the two solvers to visualize the runtime of DP-3 and Rec-DP. In doing so, I adjusted the input to match the way DP-3 works. The profits/weights are randomly generated, the coefficient profit/weight increases minimally with larger index. This forces DP-3 to iterate especially at the beginning often DP-2 with large num_items. Thus the actual running time becomes apparent as described above. |
Beta Was this translation helpful? Give feedback.
-
There is interest.
This approach works really well. It is not polynomial, but
pseudo-polynomial. It does not always win against other approaches, but
worth it.
I do not like how the papers are often misleading in the exact complexity.
This O(cW) is tricky. I still do not understand exactly where you can hit
the underlying exponential.
I will approve the PR.
Thanks for the 'lively' discussion :-)
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le ven. 16 avr. 2021 à 12:24, ruqzuq ***@***.***> a écrit :
… Excusez-moi.
I have provided the necessary details for a factual discussion. I am
willing to explain all the details. Nevertheless, I cannot deal with
misinformation. If there is no interest in external volunteer involvement,
I respect that and leave the project in silence.
I compared the two solvers to visualize the runtime of DP-3 and Rec-DP. In
doing so, I adjusted the input to match the way DP-3 works. The
profits/weights are randomly generated, the coefficient profit/weight
increases minimally with larger index. This forces DP-3 to iterate
especially at the beginning often DP-2 with large num_items. Thus the
actual running time becomes apparent as described above.
[image: comparison]
<https://user-images.githubusercontent.com/82470542/115011094-7dfa8400-9eae-11eb-84d6-a6118afeab5d.png>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2507 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3JYI462LHNU6ESWBXDTJAF5HANCNFSM427KQ6RA>
.
|
Beta Was this translation helpful? Give feedback.
-
Bonjour
the discussion refers to the PR: 2506
I would like to jointly weigh the use of an additional solver that solves one-dimensional (KP) in O(cN) Time and O(c+N) Space optimal. Like KnapsackDynamicProgrammingSolver, the technique builds on DP-2 [1], but unlike DP-3, it does not iterate all items in the worst case, but instead bounds the sub-problems by divide and conquer.
The KnapsackDynamicProgrammingSolver also has a Space Complexity of O(c + N), but it loses this with a Time Complexity of O(c(N)^2).
However, I don't think it makes sense to replace DP-3. It performs outstandingly well for certain (KP)/(SSP), even if |n| is very large. However, it can become unusable even at low |n|.
I have tested KDACS and KDPS overnight in several constellations. Because both have a linear space complexity, large |n| can be tested, if they are easy to solve for KDPS: e.g. for (SSP) with small items KDPS performs very well and on average beats KDACS in half the time even for larger |n| > 1,000,000 and c > 100,000,000.
In summary, KDACS has a running time of 2|n|c for all (KP) according to (3.1) [1] and its efficient memory consumption makes it a useful candidate if one wants to solve very large hard to solve (KP).
[1] Kellerer et al., "Knapsack Problems"
Beta Was this translation helpful? Give feedback.
All reactions