Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 28-Nov-2024 16:16:43 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 15: 0 1 1 1 1 29: 1 1 1 0 1 16: 1 0 0 0 0 29: 1 1 1 0 1 31: 1 1 1 1 1 15: 0 1 1 1 1 8: 0 1 0 0 0 26: 1 1 0 1 0 19: 1 0 0 1 1 28: 1 1 1 0 0 3: 0 0 0 1 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: 0 0 1 0 0 Weight 11 Value 23 Ratio 2.090909 Selected items: 0 1 0 0 0 Weight 7 Value 13 Ratio 1.857143 Selected items: 1 1 1 0 0 Weight 30 exceeds weight limit 26 Selected items: 1 1 1 0 0 Weight 30 exceeds weight limit 26 Selected items: 1 0 0 1 0 Weight 20 Value 39 Ratio 1.950000 Selected items: 1 0 1 1 0 Weight 31 exceeds weight limit 26 Selected items: 0 0 1 1 1 Weight 28 exceeds weight limit 26 Selected items: 1 1 1 0 1 Weight 39 exceeds weight limit 26 Selected items: 0 1 1 0 0 Weight 18 Value 36 Ratio 2.000000 Selected items: 0 0 0 0 1 Weight 9 Value 16 Ratio 1.777778 Selected items: 0 1 0 0 0 Weight 7 Value 13 Ratio 1.857143 knapsack_random_test(): Normal end of execution.