Ejemplo n.º 1
0
 def test_setting_bounds(self):
     model = Model(problem=glpk_read_cplex(TESTMODELPATH))
     var = model.variables[0]
     var.lb = 1
     self.assertEqual(var.lb, 1)
     self.assertEqual(glpk_interface.glp_get_col_lb(model.problem, var.index), 1)
     var.ub = 2
     self.assertEqual(var.ub, 2)
     self.assertEqual(glpk_interface.glp_get_col_ub(model.problem, var.index), 2)
 def test_glpk_setting_bounds(self):
     self.model.add(self.var)
     self.model.update()
     var = self.var
     model = self.model
     var.lb = 1
     self.assertEqual(var.lb, 1)
     self.assertEqual(
         glpk_interface.glp_get_col_lb(model.problem, var._index), 1)
     var.ub = 2
     self.assertEqual(var.ub, 2)
     self.assertEqual(
         glpk_interface.glp_get_col_ub(model.problem, var._index), 2)