|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Classical knapsack problem variants (0/1, unbounded, bounded). More...
#include <algorithm>#include <concepts>#include <cstddef>#include <limits>#include <type_traits>#include <utility>#include <ah-errors.H>#include <tpl_array.H>Go to the source code of this file.
Classes | |
| struct | Aleph::Knapsack_Item< W, V > |
| An item for knapsack problems. More... | |
| struct | Aleph::Knapsack_Result< V > |
| Result of a knapsack computation. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
| namespace | Aleph::knapsack_detail |
Functions | |
| template<std::integral W> | |
| size_t | Aleph::knapsack_detail::to_size_checked (const W value, const char *fn_name, const char *field_name) |
| template<std::integral W, typename V > | |
| Array< size_t > | Aleph::knapsack_detail::extract_weights_checked (const Array< Knapsack_Item< W, V > > &items, const char *fn_name) |
| template<typename V , std::integral W> | |
| Knapsack_Result< V > | Aleph::knapsack_01 (const Array< Knapsack_Item< W, V > > &items, W capacity) |
| 0/1 Knapsack with item reconstruction. | |
| template<typename V , std::integral W> | |
| V | Aleph::knapsack_01_value (const Array< Knapsack_Item< W, V > > &items, W capacity) |
| 0/1 Knapsack — value only (space-optimized). | |
| template<typename V , std::integral W> | |
| Knapsack_Result< V > | Aleph::knapsack_unbounded (const Array< Knapsack_Item< W, V > > &items, W capacity) |
| Unbounded Knapsack with reconstruction. | |
| template<typename V , std::integral W> | |
| Knapsack_Result< V > | Aleph::knapsack_bounded (const Array< Knapsack_Item< W, V > > &items, const Array< size_t > &counts, W capacity) |
| Bounded Knapsack with reconstruction. | |
Classical knapsack problem variants (0/1, unbounded, bounded).
Provides dynamic programming solutions for:
All functions support reconstruction of selected items.
Definition in file Knapsack.H.