ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 09 Jan 2015 13:34:34 -0600setting default LP solverhttp://ask.sagemath.org/question/25455/setting-default-lp-solver/I installed Gurobi, and have gotten Sage to recognize it. So when I use a command such as vertex_coloring(G,solver="GUROBI") everything works fine.
But what if I want to use instead a command such as G.chromatic_number(algorithm="MILP"). How do I make sure that the LP solver that Sage is using is Gurobi, rather than GLPK? Is there one place I can tell Sage that it should always default to Gurobi as its LP solver, or is it possible that Sage is smart enough that once Gurobi is installed it does that anyway?
(Also, peripherally: does anyone have any idea whether chromatic_number or vertex_coloring is more efficient for large graphs?)
MattKahleFri, 09 Jan 2015 13:34:34 -0600http://ask.sagemath.org/question/25455/Memory blowup with MILPhttp://ask.sagemath.org/question/8729/memory-blowup-with-milp/Hello, I have been running some code on our Sage server and it ends up using a huge amount of memory, up to around 50 GB, and then eventually stops running. No error message is generated. It's just that the green bar is gone and it isn't doing anything. This code should generate the problem. When I ran this, it ran up to around 300,000 graphs and then stopped. It should run through all 12.7 million without stopping.
count = 0
for g in graphs.nauty_geng("10"):
count = count + 1
if count % 50000 == 0:
print count
vcc = int(round(g.complement().chromatic_number(algorithm = "MILP")))
if vcc == 9:
print g.graph6_string()
Now, I talked to Jason Grout later and he mentioned that if I changed it to algorithm = "CP", not only does the memory problem not occur, it is also faster on smaller graphs. But, there is still the problem with the MILP algorithm that should be addressed at some point, I assume.
Thanks
**UPDATE:** I tried the gc.collect() and want to say it doesn't do anything.
g = graphs.PetersenGraph()
for count in [1..100000]:
if count % 5000 == 0:
print count
print get_memory_usage()
gc.collect()
print get_memory_usage()
test = g.independent_set()
the get_memory_usage() keeps getting higher and higher and higher as I do this. The way I got it to reset was to save and quit the worksheet.
Not a huge deal because we have a better fix coming, it appears. But, just wanted to point out that gc.collect() doesn't seem to do anything as far as I can tell.
**UPDATE 2:** The patch didn't work. There is still a memory leak. Here is the exact code I am running this time, after the patch was installed to our Sage server.
count = 0
for g in graphs.nauty_geng("10"):
if count % 50000 == 0:
print count
print get_memory_usage()
count = count + 1
vcc = int(round(g.chromatic_number("MILP")))
The memory usage at 0 was 808. At 50000, it was 3145. At 100000, it was 8106. At 200000, we're up to 14369.G-SageTue, 21 Feb 2012 06:56:23 -0600http://ask.sagemath.org/question/8729/