Hi,
I'm using some binary variables in Gurobi for Python:
self.y = {}
for m in range(1,self.NUM_OF_TM+1):
for n in range(1,self.N+1):
self.y[m,n]
= self.mod.addVar(name='y_%s_%s' %
(m,n), vtype=GRB.BINARY)
after have solved the model I get the variables with getAttr:
self.y_solution = self.mod.getAttr('x', self.y)
print 'self.y_solution:'
print self.y_solutionI obtain a dictionary with float variables and in most of the cases the values are 0.0 or 1.0 as expected. But I found very few instances where the values are not exactly 0 or 1, but they are something like 1e-8 or 0.99999999.
It seems strange, is there something wrong in what I'm doing?