Python given numpy array of weights, find indices which split array so that sum of each split is less than value
问题 I have an 1D array of weights, w and an array of capacities c of the same shape as w. I need to find the smallest array of indices such that when w is split by these indices, the cumsums of split arrays less than the corresponding capacities in c. Given an array of weights and capacities as follows: w = [1,2,3,4,5,6]; c = [3, 12, 7, 6, 12] I need to find the smallest number of indices 'i' so that the cumsums of split arrays less than the corresponding capacities in c. In this case, i = [2, 3,