Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 13-May-2025 15:14:37 knapsack_random_test(): MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7 Test knapsack_random() subset_random_test(): Test subset_random() Subsets will be of size n = 5 4: 0 0 1 0 0 8: 0 1 0 0 0 26: 1 1 0 1 0 26: 1 1 0 1 0 22: 1 0 1 1 0 21: 1 0 1 0 1 8: 0 1 0 0 0 16: 1 0 0 0 0 25: 1 1 0 0 1 22: 1 0 1 1 0 18: 1 0 0 1 0 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 0 0 0 Weight 7 Value 13 Ratio 1.857143 Selected items: 1 1 0 0 1 Weight 28 exceeds weight limit 26 Selected items: 0 0 0 0 1 Weight 9 Value 16 Ratio 1.777778 Selected items: 1 1 0 0 0 Weight 19 Value 37 Ratio 1.947368 Selected items: 1 1 1 0 0 Weight 30 exceeds weight limit 26 Selected items: 1 1 0 1 0 Weight 27 exceeds weight limit 26 Selected items: 1 1 0 0 1 Weight 28 exceeds weight limit 26 Selected items: 0 1 1 0 1 Weight 27 exceeds weight limit 26 Selected items: 0 1 1 1 1 Weight 35 exceeds weight limit 26 Selected items: 1 1 1 1 1 Weight 47 exceeds weight limit 26 knapsack_random_test(): Normal end of execution.