All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
knapsack_unbounded_fptas.hpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c) 2013 Piotr Wygocki
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //=======================================================================
15 #ifndef PAAL_KNAPSACK_UNBOUNDED_FPTAS_HPP
16 #define PAAL_KNAPSACK_UNBOUNDED_FPTAS_HPP
17 
21 
22 #include <boost/function_output_iterator.hpp>
23 
24 namespace paal {
25 
26 template <typename OutputIterator, typename Objects,
27  typename ObjectSizeFunctor, typename ObjectValueFunctor>
28 typename detail::knapsack_base<Objects, ObjectSizeFunctor,
29  ObjectValueFunctor>::return_type
30 knapsack_unbounded_on_value_fptas(
31  double epsilon, Objects && objects,
32  detail::FunctorOnRangePValue<ObjectSizeFunctor, Objects>
33  capacity, // capacity is of size type
34  OutputIterator out, ObjectSizeFunctor size, ObjectValueFunctor value) {
35  return detail::knapsack_general_on_value_fptas_retrieve(
36  epsilon, detail::make_knapsack_data(std::forward<Objects>(objects), capacity, size, value, out),
37  detail::unbounded_tag{});
38 }
39 
40 template <typename OutputIterator, typename Objects,
41  typename ObjectSizeFunctor, typename ObjectValueFunctor>
42 typename detail::knapsack_base<Objects, ObjectSizeFunctor,
43  ObjectValueFunctor>::return_type
44 knapsack_unbounded_on_size_fptas(
45  double epsilon, Objects && objects,
46  detail::FunctorOnRangePValue<ObjectSizeFunctor, Objects>
47  capacity, // capacity is of size type
48  OutputIterator out, ObjectSizeFunctor size, ObjectValueFunctor value) {
49  return detail::knapsack_general_on_size_fptas_retrieve(
50  epsilon, detail::make_knapsack_data(std::forward<Objects>(objects), capacity, size, value, out),
51  detail::unbounded_tag{});
52 }
53 
54 }
55 
56 #endif // PAAL_KNAPSACK_UNBOUNDED_FPTAS_HPP