I'm having trouble writing a general algorithm for what at first glance appears to be a simple problem.
If I have a volume $V_{required}$ that can be made from two smaller, different volumes how can I decide which volumes to use to get the minimum wastage? Some examples:
If $V_{required} =300$ and my smaller volumes are $V_1=60$ and $V_2=150$, one would use $2V_2$.
If $V_{required}=240$, then one would use $4V_1$.
If $V_{required}=330$ one would use $3V_1+V_2$.
Finally if $V_{required}=250$ one would use $2V_1+V_2$ with $20$ units wastage.
Is there a way to decide on the best combination for a given volume and two smaller, given volumes for the general case, minimizing wastage? Thanks.