subset_sum_swap


subset_sum_swap, a C++ code which uses swapping to try to improve an initial estimated solution of the subset sum problem, which seeks a subset of a set of integers which has a given sum. Even when an exact solution exists, this approach often only finds an approximate solution.

In the test code, we will be given a collection of 21 weights and a target value (24639098). We seek a combination of the weights which adds up to the target value, or comes very close to it.

Licensing:

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

Languages:

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

Related Data and Programs:

subset_sum_swap_test

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

Reference:

Source Code:


Last revised on 15 June 2024.