daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest May 23rd, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top