Only if you include $0.50 coins and the dollar bill itself…
$ontext |
Not 100% trivial this MIP model. Equations order and different are probably not completely obvious. The integer cut is simplified to speed things up. A constraint programming solver would probably make this easier. This particular formulation gives:
---- 82 PARAMETER countall dollar halfdollar quarter dime nickel penny w1 1 |
I use binary variables to make the cuts easier. The cuts are similar to the ones shown here: http://yetanothermathprogrammingconsultant.blogspot.com/2011/10/special-case-of-integer-cuts.html.
Note: There are at least four different ways to implement the cuts:
1) Most general way:
different(w).. - sum(cn(c,n)$(ord(n)>countall(w,c)), x(cn)) =L= sum(c,countall(w,c))-1; |
2) Exploit coins add up to fixed amount:
different(w).. sum(cn(c,n)$(ord(n)<=countall(w,c)), x(cn)) =L= sum(c,countall(w,c))-1; |
3) Exploit further that patterns like 1,0,1 are not allowed (only 1,1,0).
different(w).. sum(cn(c,n)$(ord(n)=countall(w,c)), x(cn)) =L= sum(c$countall(w,c),1)-1; |
4) Use cuts that forbid integer solutions directly instead of just binary solutions. This can be done as shown below. This approach is not very efficient for this model as we need to add binary variables during each iteration of the solve loop. In the previous approaches we augmented the model with binary variables only once (the subsequent cuts only add constraints but no extra variables). Actual implementation confirmed this general integer cuts are inferior on this problem.