I wrote a transportation linear program on my personal computer in python/gurobi. A typical constraint for demand node j
might look like this:
m.addConstr(quicksum(x[i1, j1] for (i1, j1) in arcs.select('*', j)) == demand[j])
where
x[i, j]
is a decision variable for flow on edge (i,j)
arcs
is the set of all edges between supply and demand nodes
demand[j]
is a known fractional constant of demand required at j
When I test this code out on my personal computer, it works fine. However, when I move it to my organization's computing cluster and try to run it, the right hand side (demand[j]
) is not the same and I get incorrect values for x[i,j]'s
.
When I add
float
around the right hand side, it works again.(I don't know why this problem exists or if it's only on Python)