knapsack_values


knapsack_values, a C++ code which returns some simple examples of the knapsack problem, in which N items are available, each with given value V and weight W. A thief's knapsack can carry no more than K pounds. The thief seeks a selection S of items to carry in the knapsack of maximum total value.

If the code is called repeatedly, it will return several cases with the values N, V, W, K, and S. This information can be used for testing.

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

knapsack_values is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

knapsack_values_test

cpp_combinatorics, a C++ code which considers a variety of problems in combinatorics involving counting, combinations, permutations, and so on.

Source Code:


Last revised on 20 November 2024.