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

"write" methods don't work after redirectOutput() #243

Open
mattmilten opened this issue Feb 17, 2019 · 6 comments · May be fixed by #929
Open

"write" methods don't work after redirectOutput() #243

mattmilten opened this issue Feb 17, 2019 · 6 comments · May be fixed by #929
Labels

Comments

@mattmilten
Copy link
Collaborator

mattmilten commented Feb 17, 2019

After calling redirectOutput(), e.g. writeProblem() does not produce a file but prints the problem description to the outstream.

Apparently, we redirect everything to the new messagehandler.

@fserra
Copy link
Collaborator

fserra commented Jun 2, 2020

interseting my search didn't tell me about this

@CGraczyk
Copy link
Collaborator

I assume this is still relevant so i will leave this open.

@Joao-Dionisio
Copy link
Collaborator

Is this still relevant, @mattmilten @fserra?

@camold
Copy link

camold commented Sep 6, 2023

Still not solved. Here is a minimal example:

import pyscipopt
m = pyscipopt.Model("test")
m.redirectOutput()
m.optimize()
# writes out the usual log files
m.writeProblem("test.mps")
# writes the model description (in mps format) to the python console but not to file
# test.mps is created but is empty

PySCIPOpt 4.3.0
SCIPOptSuite-8.0.4-Linux

@LuizSuzana
Copy link

A possible related issue happens when calling setLogfile and writeProblem. The problem description is written to a file (argument of writeProblem), and also to the logfile. I would expect it to not be included in the logfile.

import pyscipopt
m = pyscipopt.Model("test2")
x = m.addVar("x", vtype="B")
m.addCons(x >= 1, name="C1")
m.setLogfile('file.log')
m.optimize()
m.writeProblem("test.lp")
# file.log is created with the output from the solver, but it also contains the problem description in the lp format
# test.lp is correctly created with the problem description in the lp format

@DominikKamp
Copy link

DominikKamp commented Nov 27, 2024

I guess relayMessage() in scip.pxi should still write to file if it is not stdout and in this case the same as in logMessage should happen (otherwise file == NULL was translated into file == stdout in messagePrintInfo() before calling this function and only then it should be written to the console).

@DominikKamp DominikKamp linked a pull request Nov 29, 2024 that will close this issue
@DominikKamp DominikKamp linked a pull request Nov 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants