#12903: Memory leaks with CPLEX
--------------------------------------+-------------------------------------
       Reporter:  ncohen              |         Owner:  ncohen    
           Type:  defect              |        Status:  needs_work
       Priority:  major               |     Milestone:  sage-5.1  
      Component:  linear programming  |    Resolution:            
       Keywords:                      |   Work issues:            
Report Upstream:  N/A                 |     Reviewers:            
        Authors:                      |     Merged in:            
   Dependencies:                      |      Stopgaps:            
--------------------------------------+-------------------------------------
Changes (by dcoudert):

  * status:  needs_review => needs_work


Comment:

 Hello,

 the patch is working (install OK, long tests OK, docbuild OK). However, we
 still have memory leaks when using try except.

 This example without try/except uses constant memory, but with try/except,
 memory is constantly increasing.
 {{{
 def test(G, solver = None, verbose = 0):
     from sage.numerical.mip import MixedIntegerLinearProgram,
 MIPSolverException, Sum
     p = MixedIntegerLinearProgram(solver = solver, maximization = False)
     b = p.new_variable(dim=1)
     for u,v in G.edge_iterator(labels=False):
         p.add_constraint(b[u]+b[v] >= 1)
     p.set_objective(Sum([b[u] for u in G]))
     p.set_binary(b)
     try:
         p.solve()
         sol = p.get_values(b)
         return len([u for u in G if sol[u]==1])
     except MIPSolverException:
         print "oups"
         return 0

 def my_test(n,p,sample=1000):
     for i in xrange(sample):
         g = graphs.RandomGNP(n,p)
         res = test(g, solver = "CPLEX", verbose = 0)
         print res, get_memory_usage()
 }}}

 {{{
 sage: my_test(100,0.1, sample = 10)
 69 388.94140625
 68 388.94140625
 69 389.0703125
 71 389.0703125
 68 389.0703125
 71 389.0703125
 69 389.19921875
 69 389.19921875
 71 389.19921875
 71 389.19921875
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12903#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to