Closed abe-mart closed 6 years ago
When using the syntax m.x = m.Var(), it would be nice to be able to list the variables that are currently stored in the model, something like print(m.Vars()) perhaps. It would also be nice to be able to iterate over the variables:
print(m.Vars())
for var in m: var.value = 0
Turns out this is already implemented, but not documented that I can find: list(m.variables) or
list(m.variables)
for v in m.variables: print(v)
This is now in the documentation. Thanks!
When using the syntax m.x = m.Var(), it would be nice to be able to list the variables that are currently stored in the model, something like
print(m.Vars())
perhaps. It would also be nice to be able to iterate over the variables: