05-Nov-2022 18:17:10 subset_sum_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test subset_sum(). subset_sum_count_tests(): subset_sum_count_test() calls subset_sum_count() with a particular set of weights and target. subset_sum_count_test(): subset_sum_count() counts solutions to the subset sum problem in a given range. Seek a subset of W that sums to T. Target value T = 53 I W(I) 1 15 2 22 3 14 4 26 5 32 6 9 7 16 8 8 Searching indices 0 through 255 Number of solutions in [0,255] is 3. subset_sum_count_test(): subset_sum_count() counts solutions to the subset sum problem in a given range. Seek a subset of W that sums to T. Target value T = 5842 I W(I) 1 267 2 493 3 869 4 961 5 1000 6 1153 7 1246 8 1598 9 1766 10 1922 Searching indices 0 through 1023 Number of solutions in [0,1023] is 1. subset_sum_count_test(): subset_sum_count() counts solutions to the subset sum problem in a given range. Seek a subset of W that sums to T. Target value T = 2463098 I W(I) 1 518533 2 1037066 3 2074132 4 1648264 5 796528 6 1593056 7 686112 8 1372224 9 244448 10 488896 11 977792 12 1955584 13 1411168 14 322336 15 644672 16 1289344 17 78688 18 157376 19 314752 20 629504 21 1259008 Searching indices 0 through 2097151 Number of solutions in [0,2097151] is 1. subset_sum_count_test(): subset_sum_count() counts solutions to the subset sum problem in a given range. Seek a subset of W that sums to T. Target value T = 50 I W(I) 1 41 2 34 3 21 4 20 5 8 6 7 7 7 8 4 9 3 10 3 Searching indices 0 through 1023 Number of solutions in [0,1023] is 2. subset_sum_count_test(): subset_sum_count() counts solutions to the subset sum problem in a given range. Seek a subset of W that sums to T. Target value T = 100 I W(I) 1 81 2 80 3 43 4 40 5 30 6 26 7 12 8 11 9 9 Searching indices 0 through 511 Number of solutions in [0,511] is 1. subset_sum_count_test(): subset_sum_count() counts solutions to the subset sum problem in a given range. Seek a subset of W that sums to T. Target value T = 22 I W(I) 1 1 2 2 3 4 4 8 5 16 6 32 Searching indices 0 through 63 Number of solutions in [0,63] is 1. subset_sum_count_test(): subset_sum_count() counts solutions to the subset sum problem in a given range. Seek a subset of W that sums to T. Target value T = 50 I W(I) 1 25 2 27 3 3 4 12 5 6 6 15 7 9 8 30 9 21 10 19 Searching indices 0 through 1023 Number of solutions in [0,1023] is 1. subset_sum_find_tests(): subset_sum_find_test() calls subset_sum_find() with a particular set of weights and target. subset_sum_find_test(): subset_sum_find() seeks a subset of W that sums to T. Target value T = 53 I W(I) 1 15 2 22 3 14 4 26 5 32 6 9 7 16 8 8 Searching indices 0 through 255 Solution code: 67 Binary version: 11000010 # I W(I) 1 1 15 2 2 22 3 7 16 Total: 53 subset_sum_find_test(): subset_sum_find() seeks a subset of W that sums to T. Target value T = 53 I W(I) 1 15 2 22 3 14 4 26 5 32 6 9 7 16 8 8 Searching indices 68 through 255 Solution code: 166 Binary version: 01100101 # I W(I) 1 2 22 2 3 14 3 6 9 4 8 8 Total: 53 subset_sum_find_test(): subset_sum_find() seeks a subset of W that sums to T. Target value T = 5842 I W(I) 1 267 2 493 3 869 4 961 5 1000 6 1153 7 1246 8 1598 9 1766 10 1922 Searching indices 0 through 1023 Solution code: 348 Binary version: 0011101010 # I W(I) 1 3 869 2 4 961 3 5 1000 4 7 1246 5 9 1766 Total: 5842 subset_sum_find_test(): subset_sum_find() seeks a subset of W that sums to T. Target value T = 2463098 I W(I) 1 518533 2 1037066 3 2074132 4 1648264 5 796528 6 1593056 7 686112 8 1372224 9 244448 10 488896 11 977792 12 1955584 13 1411168 14 322336 15 644672 16 1289344 17 78688 18 157376 19 314752 20 629504 21 1259008 Searching indices 0 through 2097151 Solution code: 524306 Binary version: 010010000000000000010 # I W(I) 1 2 1037066 2 5 796528 3 20 629504 Total: 2463098 subset_sum_find_test(): subset_sum_find() seeks a subset of W that sums to T. Target value T = 50 I W(I) 1 41 2 34 3 21 4 20 5 8 6 7 7 7 8 4 9 3 10 3 Searching indices 0 through 1023 Solution code: 500 Binary version: 0010111110 # I W(I) 1 3 21 2 5 8 3 6 7 4 7 7 5 8 4 6 9 3 Total: 50 subset_sum_find_test(): subset_sum_find() seeks a subset of W that sums to T. Target value T = 100 I W(I) 1 81 2 80 3 43 4 40 5 30 6 26 7 12 8 11 9 9 Searching indices 0 through 511 Solution code: 386 Binary version: 010000011 # I W(I) 1 2 80 2 8 11 3 9 9 Total: 100 subset_sum_find_test(): subset_sum_find() seeks a subset of W that sums to T. Target value T = 22 I W(I) 1 1 2 2 3 4 4 8 5 16 6 32 Searching indices 0 through 63 Solution code: 22 Binary version: 011010 # I W(I) 1 2 2 2 3 4 3 5 16 Total: 22 subset_sum_find_test(): subset_sum_find() seeks a subset of W that sums to T. Target value T = 50 I W(I) 1 25 2 27 3 3 4 12 5 6 6 15 7 9 8 30 9 21 10 19 Searching indices 0 through 1023 Solution code: 529 Binary version: 1000100001 # I W(I) 1 1 25 2 5 6 3 10 19 Total: 50 subset_sum_next_tests(): subset_sum_next_test() solves the subset sum problem for specific values of S, N and V. subset_sum_next_test(): subset_sum_next() finds the "next" subset of the values V which sum to the desired total S. Desired sum S = 9 Number of targets = 5 Targets: 1 2 3 5 7 1: 9 = 1+3+5 2: 9 = 2+7 subset_sum_next_test(): subset_sum_next() finds the "next" subset of the values V which sum to the desired total S. Desired sum S = 8 Number of targets = 9 Targets: 1 2 3 4 5 6 7 8 9 1: 8 = 1+2+5 2: 8 = 1+3+4 3: 8 = 1+7 4: 8 = 2+6 5: 8 = 3+5 6: 8 = 8 subset_sum_next_test(): subset_sum_next() finds the "next" subset of the values V which sum to the desired total S. Desired sum S = 8 Number of targets = 9 Targets: 1 2 3 3 5 6 7 8 9 1: 8 = 1+2+5 2: 8 = 1+7 3: 8 = 2+3+3 4: 8 = 2+6 5: 8 = 3+5 6: 8 = 3+5 7: 8 = 8 subset_sum_next_test(): subset_sum_next() finds the "next" subset of the values V which sum to the desired total S. Desired sum S = 18 Number of targets = 5 Targets: 1 2 3 5 7 1: 18 = 1+2+3+5+7 subset_sum_next_test(): subset_sum_next() finds the "next" subset of the values V which sum to the desired total S. Desired sum S = 5842 Number of targets = 10 Targets: 267 493 869 961 1000 1153 1246 1598 1766 1922 1: 5842 = 869+961+1000+1246+1766 subset_sum_table_tests(): subset_sum_table_test() calls subset_sum_table() with a particular set of weights and target. subset_sum_table_test(): subset_sum_table() seeks a subset of W that sums to T. Target value T = 53 I W(I) 1 15 2 22 3 14 4 26 5 32 6 9 7 16 8 8 53 = 16 + 22 + 15 subset_sum_table_test(): subset_sum_table() seeks a subset of W that sums to T. Target value T = 5842 I W(I) 1 267 2 493 3 869 4 961 5 1000 6 1153 7 1246 8 1598 9 1766 10 1922 5842 = 1766 + 1246 + 1000 + 961 + 869 subset_sum_table_test(): subset_sum_table() seeks a subset of W that sums to T. Target value T = 2463098 I W(I) 1 518533 2 1037066 3 2074132 4 1648264 5 796528 6 1593056 7 686112 8 1372224 9 244448 10 488896 11 977792 12 1955584 13 1411168 14 322336 15 644672 16 1289344 17 78688 18 157376 19 314752 20 629504 21 1259008 2463098 = 629504 + 796528 + 1037066 subset_sum_table_test(): subset_sum_table() seeks a subset of W that sums to T. Target value T = 50 I W(I) 1 41 2 34 3 21 4 20 5 8 6 7 7 7 8 4 9 3 10 3 50 = 3 + 4 + 7 + 7 + 8 + 21 subset_sum_table_test(): subset_sum_table() seeks a subset of W that sums to T. Target value T = 100 I W(I) 1 81 2 80 3 43 4 40 5 30 6 26 7 12 8 11 9 9 100 = 9 + 11 + 80 subset_sum_table_test(): subset_sum_table() seeks a subset of W that sums to T. Target value T = 22 I W(I) 1 1 2 2 3 4 4 8 5 16 6 32 22 = 16 + 4 + 2 subset_sum_table_test(): subset_sum_table() seeks a subset of W that sums to T. Target value T = 50 I W(I) 1 25 2 27 3 3 4 12 5 6 6 15 7 9 8 30 9 21 10 19 50 = 19 + 6 + 25 subset_sum_test(): Normal end of execution. 05-Nov-2022 18:17:16