Talk:Knapsack problem/Bounded: Difference between revisions

section removed
No edit summary
(section removed)
 
(2 intermediate revisions by the same user not shown)
Line 25:
Currently the OOCalc implementation claims that it is trying to minimize the total value of items contained in the pack. Shouldn't it be trying to maximize that instead? --[[User:Rdm|Rdm]] 15:54, 28 June 2011 (UTC)
:Yep, the image was correct, I just wrote the wrong thing in the accompanying text. Fixed now, thanks. --[[User:Paddy3118|Paddy3118]] 18:28, 28 June 2011 (UTC)
 
==Possible optimisation==
In the Phix solution, I noticed the order of goodies had an impact on search time, ranging from 12s
(highest value/fewest items first) to 28s (lowest value first), which got me thinking. I also noticed
that sometimes the optimal solution was found very early, and came up with a little theorem.
 
If we sort by weighted value, and on the last item (given that we have been greedy) we can take the
full complement, I believe that means we must be on or have passed through the optimal solution.
 
Since I am not entirely convinced that hypothesis is right (it does seem rather unlikely that no-one has ever thought of it before),
I have left the Phix solution such that it completes the full scan and crashes if a disproving dataset is used.
One thing I have tried is increasing the available beer: at 8 and above it never displays "terminate" (it is the last item
and 8 will not fit) and must perform a full search, which I view as a good sign, even though it
means there is no gain in such circumstances. It is also interesting to note that we can terminate
even if the selection being inspected has not improved matters. [[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 13:58, 15 March 2017 (UTC)
7,803

edits