Knapsack problem/Unbounded: Difference between revisions

Contribution reconstruction due to vandalism.
(Contribution reconstruction due to vandalism.)
Line 3,494:
 
MILP solver output:
<pre>TotalValue
TotalValue
54500
 
Line 3,527 ⟶ 3,526:
gold (bars) 11
ichor (ampules of) 0
panacea (vials of) 9 </pre>
</pre>
 
=={{header|Scala}}==
 
===Functional approach (Tail recursive)===
 
<lang scala>import scala.annotation.tailrec
Line 3,574 ⟶ 3,569:
 
{{out}}
 
<pre>
[panacea: 0, ichor: 15, gold: 11 | value: 54500, weight: 25.0, volume: 0.247]
Line 3,581 ⟶ 3,575:
[panacea: 9, ichor: 0, gold: 11 | value: 54500, weight: 24.7, volume: 0.247]
</pre>
{{Out}}See it in running in your browser by [https://scalafiddle.io/sf/1fRBQs5/2 ScalaFiddle (JavaScript)] or by [https://scastie.scala-lang.org/S4oGElcwQkCMesfuSRKfkw Scastie (JVM)].
 
=={{header|Seed7}}==
<lang seed7>$ include "seed7_05.s7i";
Anonymous user