Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppressing output for "default" solver #325

Closed
vgupta1 opened this issue Nov 30, 2014 · 4 comments
Closed

Suppressing output for "default" solver #325

vgupta1 opened this issue Nov 30, 2014 · 4 comments

Comments

@vgupta1
Copy link

vgupta1 commented Nov 30, 2014

Hey all,

Is there a way to instruct the solver object to suppress logging information in a solver-agnostic way? For example, I can always write:

m = Model(solver=GurobiSolver(OutputFlag=0) )

but this assumes the user's machine has Gurobi installed. If I write:

m = Model()

and let's JuMP sort it out on the backend, depending on the choice of solver, it dumps a ton of auxiliary stuff to the console. (This is particularly annoying if you're calling JuMP within the context of another program, or writing tests.)

Is there an existing solver-independent way of suppressing output? Ideally, I"d like to write something like:

m = Model(quiet=true)

and have JuMP both select the solver, and set the default option to suppress output. Thoughts?

Vishal

@mlubin
Copy link
Member

mlubin commented Nov 30, 2014

Related to #91. We currently don't have a way to set options in a solver-agnostic way. In this particular case you don't need to set any solver options, just redirect STDOUT before solving:

TT = STDOUT # save original STDOUT stream
redirect_stdout()
solve(m)
redirect_stdout(TT) # restore STDOUT

Not sure if we should implement this trick in JuMP or leave it for users.

@joehuchette
Copy link
Contributor

Ideally we would expose solver-independent parameters like this (e.g. Model(quiet=true)), while making the interface clearly distinct from the usual way of passing solver parameters. Not sure how to do that, though.

@vgupta1
Copy link
Author

vgupta1 commented Nov 30, 2014

Thanks Miles! I'll use that for now, although fwiw, it seems a little
cludgey to me. I agree with Iain in #91 that there should be a sort of
generic way to set generic options...

On Sat Nov 29 2014 at 9:05:15 PM Joey Huchette notifications@github.com
wrote:

Ideally we would expose solver-independent parameters like this (e.g.
Model(quiet=true)), while making the interface clearly distinct from the
usual way of passing solver parameters. Not sure how to do that, though.


Reply to this email directly or view it on GitHub
#325 (comment).

mlubin added a commit that referenced this issue Nov 30, 2014
@mlubin
Copy link
Member

mlubin commented Nov 30, 2014

Added this to the FAQ. Closing in favor of #91.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants