I understand how arranging images may be a "knapsack problem" but I can't pinpoint what the algorithm is supposed to be.
I understand how arranging images may be a "knapsack problem" but I can't pinpoint what the algorithm is supposed to be.
To the best of my knowledge there is no such thing as "The Knapsack Algorithm." (Except in the (now broken) Knapsack Public Key Encryption system)
The only references I've found in a quick search either incorrectly use the term "Knapsack Algorithm" when they actually mean "Knapsack Problem," or they simply refer to the obvious depth-first recursive search.
So the question remains - what algorithm are you using? Depth-first search? Dynamic programming? Greedy algorithm with heuristics and early cut-off? Simulated Annealing? Hill-Climbing? All of these can be used to find good solutions to an instance of the Knapsack Problem.
The auxiliary question: Given that the Knapsack Problem has been shown to be NP-Complete, what will your code do when given a hard instance?
What would happen if I encoded a large integer factorization instance into a Knapsack Problem and called your system?
But it could as well terminate early, providing a suboptimal but fast solution.