daily pastebin goal
94%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using JuMP
  2. using GLPKMathProgInterface
  3.  
  4. m = Model(solver = GLPKSolverLP())
  5. @variable(m,x1 >= 0)
  6. @variable(m,x2 >= 0)
  7. @variable(m,x3 >= 0)
  8. @variable(m,v >= 0)
  9.  
  10. @objective(m,Max,v)
  11. @constraint(m, 4x1+3x2+5x3 - v >= 0)
  12. @constraint(m, 5x1+6x2 - v >= 0)
  13. @constraint(m, 3x1+2x2+x3 - v >= 0)
  14. @constraint(m, x1+x2+x3 == 1)
  15.  
  16. status = solve(m)
  17.  
  18. println("Objective function: ", getobjectivevalue(m))
  19. println("x1 = ",getvalue(x1))
  20. println("x2 = ",getvalue(x2))
  21. println("x3 = ",getvalue(x3))
RAW Paste Data
Top