15-May-2025 08:18:52 knapsack_random_test(): MATLAB/Octave version 6.4.0 Test knapsack_random() subset_random_test(): Test subset_random() Subsets will be of size n = 5 28: 1 1 1 0 0 4: 0 0 1 0 0 27: 1 1 0 1 1 14: 0 1 1 1 0 27: 1 1 0 1 1 7: 0 0 1 1 1 31: 1 1 1 1 1 20: 1 0 1 0 0 4: 0 0 1 0 0 19: 1 0 0 1 1 21: 1 0 1 0 1 knapsack_random_test01(): knapsack_random() randomly selects a subset of n items and considers it as a solution to a knapsack problem. Maximize profit without exceeding weight limit. Number of items is 5 Value array: 24 13 23 15 16 Weight array: 12 7 11 8 9 Weight limit is 26 Selected items: 1 0 1 1 0 Weight 31 exceeds weight limit 26 Selected items: 0 1 1 1 1 Weight 35 exceeds weight limit 26 Selected items: 0 0 0 1 0 Weight 8 Value 15 Ratio 1.875000 Selected items: 0 0 0 1 0 Weight 8 Value 15 Ratio 1.875000 Selected items: 1 1 0 1 1 Weight 36 exceeds weight limit 26 Selected items: 0 0 1 1 0 Weight 19 Value 38 Ratio 2.000000 Selected items: 0 0 0 1 0 Weight 8 Value 15 Ratio 1.875000 Selected items: 1 1 0 1 1 Weight 36 exceeds weight limit 26 Selected items: 1 1 1 0 1 Weight 39 exceeds weight limit 26 Selected items: 0 0 0 0 1 Weight 9 Value 16 Ratio 1.777778 Selected items: 1 1 1 0 0 Weight 30 exceeds weight limit 26 knapsack_random_test(): Normal end of execution.