We are formulating an optimization problem in Mosek (via its Pyomo interface).
We required to dump the problem in opf
format.
To enable this, we activated the iparam.opf_write_problem
[0] solver option, but failed (i.e. no opf
file created).
Minimal reproducible example:
import pyomo.environ as pyo
import mosek
model = pyo.ConcreteModel()
model.x = pyo.Var([1,2], domain=pyo.NonNegativeReals)
model.OBJ = pyo.Objective(expr = 2*model.x[1] + 3*model.x[2])
model.Constraint1 = pyo.Constraint(expr = 3*model.x[1] + 4*model.x[2] >= 1)
opt = pyo.SolverFactory("mosek")
opt.solve(model, options={'iparam.opf_write_problem': 1}) # doesn't create opf file
# opt.solve(model, options={'iparam.opf_write_problem': mosek.onoffkey.on}) # fails too
Is this a bug in Mosek or Pyomo?
Reference:
[0] https://docs.mosek.com/9.2/toolbox/parameters.html#mosek.iparam.opf_write_problem
These opf parameters only dictate which parts of the data are supposed to be included the opf file when it is being written and which not.
To actually write a file from Pyomo follow the example in https://docs.mosek.com/9.2/faq/faq.html#pyomo, changing the file name to something.opf.