All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
Public Member Functions | List of all members
paal::detail::Knapsack_0_1< Objects, ObjectSizeFunctor, ObjectValueFunctor, Comparator > Class Template Reference

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
 

Detailed Description

template<typename Objects, typename ObjectSizeFunctor, typename ObjectValueFunctor, typename Comparator>
class paal::detail::Knapsack_0_1< Objects, ObjectSizeFunctor, ObjectValueFunctor, Comparator >

This class helps solving 0/1 knapsack problem. Function solve returns the optimal value Function Retrieve solution returns chosen elements.

Template Parameters
Objects
ObjectSizeFunctor
ObjectValueFunctor

Definition at line 59 of file knapsack_0_1.hpp.

Member Function Documentation

template<typename Objects , typename ObjectSizeFunctor , typename ObjectValueFunctor , typename Comparator >
template<typename GetBestElement >
ReturnType paal::detail::Knapsack_0_1< Objects, ObjectSizeFunctor, ObjectValueFunctor, Comparator >::solve ( Objects  objects,
SizeType  capacity,
GetBestElement  getBest 
)
inline

Function solves dynamic programming problem.

Returns
the optimal value

Definition at line 82 of file knapsack_0_1.hpp.


The documentation for this class was generated from the following file: