Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using JuMP
- using GLPKMathProgInterface
- m = Model(solver = GLPKSolverMIP())
- @variable(m, x[1:8] >= 0)
- d = [0,2,4,4,3,2,3,0]
- #@objective(m, Min, sum(x[i]*d[i] for i = 1:8))
- @objective(m, Min, x[8])
- @constraint(m, x[4] - x[2] >= d[2])
- @constraint(m, x[5] - x[2] >= d[2])
- @constraint(m, x[5] - x[3] >= d[3])
- @constraint(m, x[6] - x[4] >= d[4])
- @constraint(m, x[7] - x[5] >= d[5])
- @constraint(m, x[8] - x[6] >= d[6])
- @constraint(m, x[8] - x[7] >= d[7])
- status = solve(m)
- println("Objective = ", getobjectivevalue(m))
- println("X = ", getvalue(x))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement