Guest User

Untitled

a guest
May 23rd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. def creatingvarriables(self):
  2. self.a = self.model.addVar(lb=0, vtype=GRB.CONTINUOUS, name="y_")
  3. self.b = self.model.addVar(lb=0, vtype=GRB.CONTINUOUS, name="q_")
  4. self.model.update()
  5. def constraint1(self):
  6. lhs1 = self.model.getVarByName("y_")
  7. lhs1 = 2
  8. rhs1 = self.model.getVarByName("q_")
  9. rhs1 = 3
  10. self.model.update()
  11. self.model.addConstr(lhs1, GRB.LESS_EQUAL, rhs1)
  12.  
  13.  
  14. def printvalues(self):
  15. self.model.optimize()
  16. #self.model.printAttr('')
  17. print self.a.X
  18. print self.b.X
  19.  
  20. newobject = abc()
  21. newobject.creatingvarriables()
  22. newobject.constraint1()
  23. newobject.printvalues()
Add Comment
Please, Sign In to add comment