I am having problems with
JuMP.write_to_file which calls
MOI.write_to_file. I had some problems using
Model with no solver attached (because this calls the MOI function mentioned above and, at the moment, it seems a little memory-hungry and limited, not supporting
.rew and the like), so I wanted to try having a solver attached (CPLEX or Gurobi), and using it to write the MPS and started writing an alternative to
JuMP.write_to_file that tried to be native if possible, however I am hitting some problems.
My code is here, the highlighted line emphasizes my current problem. Independently of the the model being a
direct_model or a
Model, I hit a
ERROR: OptimizeNotCalled() for trying to get the
MOI.RawSolver() from the model object to call the specific solver saving/writing method. I tried
MOI.attach_optimizer when it is a
Model (and has a
CachingOptimizer underlying) but this had no effect.