PySCIPOpt icon indicating copy to clipboard operation
PySCIPOpt copied to clipboard

writeBestSol method not working

Open kothariharshit opened this issue 4 years ago • 2 comments

from pyscipopt import Model
model = Model("Example") 
x = model.addVar("x")
y = model.addVar("y", vtype="INTEGER")
model.setObjective(x + y)
model.addCons(2*x - y >= 0)
model.optimize()
model.writeBestSol(filename="origprob.sol", write_zeros=True)

This leads to the following error.

OSError: [Errno 9] Bad file descriptor

I also noticed that the solution file is created, and has the correct solution, but still the code terminates with this OSerror. (I am using MacOS). Please let me know if any other information is needed. Thanks.

kothariharshit avatar Mar 06 '22 18:03 kothariharshit

i am assuming this is related to the issues in #542 / #543, @mattmilten any update on this?

CGraczyk avatar Mar 16 '22 10:03 CGraczyk

I can reproduce this issue and removing fclose fixes it.

mattmilten avatar Mar 19 '22 20:03 mattmilten