There is a list / array of arbitrary length with integer values. It is necessary to make up from the elements the minimum number of groups in which the sum of the numbers is not greater than the specified value. There is a written algorithm that sorts and forms data groups, but it is rather cumbersome and can work slowly in case of a large amount of data. Does it make sense to decide to use an artificial neural network? Is it possible to train it, if the input data and the maximum sum of numbers in the group can be any?
Example:
Input data:
List of numbers: [6, 1, 6, 2, 4, 3, 1, 2, 2, 3, 2].
Maximum group amount: 10.
The task: to form the minimum number of groups, all groups should be as complete as possible, except for one (minimum balance).
The correct answer is: [1, 1, 2, 6], [2, 2, 6], [3, 3, 4], [2]
Solution: The sum of the numbers in the list is 32. Accordingly, the minimum number of groups is 4; minimum balance - 2; There are 3 groups of numbers, where the sum of the numbers is 10. The problem is that there can be a lot of such numbers and not everything can be perfectly decomposed into groups.
I solved the task without any programming patterns. I am just interested in the possibility and expediency of using ANNs or something similar for a better solution of the problem.