We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 457f623 commit b7e4a20Copy full SHA for b7e4a20
README.md
@@ -30,16 +30,17 @@ This example shows how we can model a simple knapsack problem with JuMP and use
30
```julia
31
using JuMP
32
import ECOS
33
-m = Model(solver=ECOS.ECOSSolver())
34
35
items = [:Gold, :Silver, :Bronze]
36
values = [:Gold => 5.0, :Silver => 3.0, :Bronze => 1.0]
37
weight = [:Gold => 2.0, :Silver => 1.5, :Bronze => 0.3]
38
+m = Model(solver=ECOS.ECOSSolver())
39
@defVar(m, 0 <= take[items] <= 1) # Define a variable for each item
40
@setObjective(m, Max, sum{ values[item] * take[item], item in items})
41
@addConstraint(m, sum{ weight[item] * take[item], item in items} <= 3)
42
solve(m)
43
+
44
println(getValue(take))
45
# take
46
# [ Gold] = 0.9999999680446406
0 commit comments