writeBestSol method not working in pyscipopt

237 views Asked by At

I want to get a solution of one optimization problem, and use it to warm start another problem.

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=False)

This leads to the following error. Any ideas how to solve this?

OSError: [Errno 9] Bad file descriptor

1

There are 1 answers

2
mattmilten On BEST ANSWER

This error points to a general issue while writing the file. It's not possible to diagnose this further without additional information. Did you verify that you can write to the current directory? Is the file maybe already open in some other program, blocking the file access?

You should probably open an issue on PySCIPOpt GitHub.