Find minimum number of coins that make a given value: Difference between revisions

Content added Content deleted
mNo edit summary
Line 42: Line 42:


optimize!(model)
optimize!(model)
println("Optimized totasl coins: ", objective_value(model))
println("Optimized total coins: ", objective_value(model))
for val in [ones, twos, fives, tens, twenties, fifties, onehundreds, twohundreds]
for val in [ones, twos, fives, tens, twenties, fifties, onehundreds, twohundreds]
println("Value of ", string(val), " is ", value(val))
println("Value of ", string(val), " is ", value(val))
Line 48: Line 48:
</lang>{{out}}
</lang>{{out}}
<pre>
<pre>
Optimized totasl coins: 11.0
Optimized total coins: 11.0
Value of ones is 1.0
Value of ones is 1.0
Value of twos is 1.0
Value of twos is 1.0
Line 58: Line 58:
Value of twohundreds is 4.0
Value of twohundreds is 4.0
</pre>
</pre>



=={{header|Ring}}==
=={{header|Ring}}==