Here is a bit of code:
# foo.py
def dot_prod(v, w):
return sum(x*y for (x, y) in zip(v, w))
def get_polytope(M):
q = MixedIntegerLinearProgram( maximization = False, solver = 'Coin' )
w = q.new_variable(real = True, nonnegative = True)
for v in M.rows():
q.add_constraint( dot_prod(v, w) == 0 )
return q.polyhedron()
M = Matrix([[1,0],[0,1]])
def fill_memory(n):
for i in xrange(n):
P = get_polytope(M)
Now I can do the following:
[Code]$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.8, Release Date: 2015-07-26 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: attach('foo.py')
sage: get_memory_usage()
288.58984375
sage: fill_memory(2000); get_memory_usage()
300.5859375
sage: fill_memory(2000); get_memory_usage()
302.5859375sage: fill_memory(2000); get_memory_usage()
303.5859375sage: fill_memory(2000); get_memory_usage()
305.5859375It seems like MixedIntegerLinearProgram is leaking memory. This kills my computer during long computations.
Suggestions?
all the best,
saul