Combinatorics optimization problem: combine 1D arrays of size 4 such that their sum does not exceed [200,200,200,200]. Minimize no. of combinations.

48 Views Asked by At

I would need some help. Please forgive my lack of mathematical annotations.

Problem: I have a large set of 1D-arrays of size 4 and value range [0, 200]. E.g.: [0, 10, 83, 92], [20, 180, 10, 100], [1, 0, 9, 2], [150, 20, 30, 20], etc. I would like to combine/group these arrays such that the addition of the arrays in one group does not exceed [200, 200, 200, 200]. Furthermore, the number of groups should be minimized, making it a combinatorics and optimization problem.

Example: E.g. one group can contain [50, 50, 50, 50] + [50, 50, 50, 50] + [100, 100, 100, 100] <= [200, 200, 200, 200], but not [180, 180, 180, 180] + [100, 100, 100, 100] > 200.

Tools: I work with Python and am trying to prevent using optimizers such as scipy.optimize. Maybe there is one single solution?

Please ask questions if anything remains unclear. Thank you in advance and kind regards.