This class helps solving 0/1 knapsack problem. Function solve returns the optimal value Function Retrieve solution returns chosen elements. More...
#include <knapsack_0_1.hpp>
Public Member Functions | |
Knapsack_0_1 (ObjectSizeFunctor size, ObjectValueFunctor value, Comparator compare=Comparator()) | |
template<typename GetBestElement > | |
ReturnType | solve (Objects objects, SizeType capacity, GetBestElement getBest) |
Function solves dynamic programming problem. More... | |
template<typename OutputIterator > | |
void | retrieve_solution (ValueType maxValue, SizeType size, Objects objects, OutputIterator &out) const |
This class helps solving 0/1 knapsack problem. Function solve returns the optimal value Function Retrieve solution returns chosen elements.
Objects | |
ObjectSizeFunctor | |
ObjectValueFunctor |
Definition at line 59 of file knapsack_0_1.hpp.
|
inline |
Function solves dynamic programming problem.
Definition at line 82 of file knapsack_0_1.hpp.