All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
knapsack_0_1_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_0_1_FPTAS_HPP
16 #define PAAL_KNAPSACK_0_1_FPTAS_HPP
17 
20 
21 namespace paal {
22 
23 template <typename OutputIterator, typename Objects, typename ObjectSizeFunctor,
24  typename ObjectValueFunctor>
25 typename detail::knapsack_base<Objects, ObjectSizeFunctor,
26  ObjectValueFunctor>::return_type
27 knapsack_0_1_on_value_fptas(
28  double epsilon, Objects &&objects,
29  detail::FunctorOnRangePValue<ObjectSizeFunctor, Objects>
30  capacity, // capacity is of size type
31  OutputIterator out, ObjectSizeFunctor size, ObjectValueFunctor value) {
32  return detail::knapsack_general_on_value_fptas_retrieve(
33  epsilon, detail::make_knapsack_data(std::forward<Objects>(objects),
34  capacity, size, value, out),
35  detail::zero_one_tag{});
36 }
37 
38 template <typename OutputIterator, typename Objects, typename ObjectSizeFunctor,
39  typename ObjectValueFunctor>
40 typename detail::knapsack_base<Objects, ObjectSizeFunctor,
41  ObjectValueFunctor>::return_type
42 knapsack_0_1_on_size_fptas(
43  double epsilon, Objects &&objects,
44  detail::FunctorOnRangePValue<ObjectSizeFunctor, Objects>
45  capacity, // capacity is of size type
46  OutputIterator out, ObjectSizeFunctor size, ObjectValueFunctor value) {
47  return detail::knapsack_general_on_size_fptas_retrieve(
48  epsilon, detail::make_knapsack_data(std::forward<Objects>(objects),
49  capacity, size, value, out),
50  detail::zero_one_tag{});
51 }
52 
53 template <typename Objects, typename ObjectSizeFunctor,
54  typename ObjectValueFunctor>
55 typename detail::knapsack_base<Objects, ObjectSizeFunctor,
56  ObjectValueFunctor>::return_type
57 knapsack_0_1_no_output_on_value_fptas(
58  double epsilon, Objects &&objects,
59  detail::FunctorOnRangePValue<ObjectSizeFunctor, Objects>
60  capacity, // capacity is of size type
61  ObjectSizeFunctor size, ObjectValueFunctor value) {
62  auto out = boost::make_function_output_iterator(utils::skip_functor());
63  return detail::knapsack_general_on_value_fptas(
64  epsilon, detail::make_knapsack_data(std::forward<Objects>(objects),
65  capacity, size, value, out),
66  detail::zero_one_tag{}, detail::no_retrieve_solution_tag{});
67 }
68 
69 template <typename Objects, typename ObjectSizeFunctor,
70  typename ObjectValueFunctor>
71 typename detail::knapsack_base<Objects, ObjectSizeFunctor,
72  ObjectValueFunctor>::return_type
73 knapsack_0_1_no_output_on_size_fptas(
74  double epsilon, Objects &&objects,
75  detail::FunctorOnRangePValue<ObjectSizeFunctor, Objects>
76  capacity, // capacity is of size type
77  ObjectSizeFunctor size, ObjectValueFunctor value) {
78  auto out = boost::make_function_output_iterator(utils::skip_functor());
79  return detail::knapsack_general_on_size_fptas(
80  epsilon, detail::make_knapsack_data(std::forward<Objects>(objects),
81  capacity, size, value, out),
82  detail::zero_one_tag{}, detail::no_retrieve_solution_tag{});
83 }
84 
85 } // paal
86 
87 #endif // PAAL_KNAPSACK_0_1_FPTAS_HPP
Functor does nothing.
Definition: functors.hpp:52