Ask Your Question
0

setting default LP solver

asked 2015-01-09 20:34:34 +0200

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?)

edit retag flag offensive close merge delete

Comments

About your comment on coloring algorithms: it heavily depend on the LP solver that you use, and then it depends on the graphs themselves.

Nathann gravatar imageNathann ( 2015-01-10 05:43:57 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2015-01-09 21:38:09 +0200

tmonteil gravatar image

By default Sage choses what it considers fastest among installed solvers, hence in your case gurobi should have been selected by default. You can check by typing:

sage: default_mip_solver()

and see the result. You can also use this function to reset the default solver (this can be useful e.g. for benchmarking):

sage: default_mip_solver("GUROBI")

or

sage: default_mip_solver("GLPK")

The doc can be found here.

edit flag offensive delete link more
1

answered 2015-01-10 05:42:43 +0200

Nathann gravatar image

The best answer was given by Thierry, but there is another 'trick': all solvers have a different way to be verbose about their computations, so you can see what MILP solver is used by calling that:

sage: graphs.PetersenGraph().chromatic_number(algorithm="MILP",verbose=2)

Nathann

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-01-09 20:34:34 +0200

Seen: 643 times

Last updated: Jan 10 '15