Maybe you can try a negative weight to combinations whose sum exceeds the maximum.
This example (bottom screenshot of link) is linear. Perhaps you can use exponents.
Maybe you can try a negative weight to combinations whose sum exceeds the maximum.
This example (bottom screenshot of link) is linear. Perhaps you can use exponents.