knapsack_brute


knapsack_brute, an Octave code which uses brute force to solve small versions of the knapsack problem, in which N items are available, each with given value and weight. A thief's knapsack can carry no more than Wmax pounds. The thief seeks a selection of items to carry in the knapsack of maximum total value.

This code uses a simple brute force or exhaustive search method, which is guaranteed to get the optimal solution, but which is not efficient for large values of N.

Licensing:

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

Languages:

knapsack_brute 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_brute_test

octave_combinatorics, an Octave code which considers a variety of problems in combinatorics involving counting, combinations, permutations, and so on.

Source Code:


Last revised on 26 November 2024.