Gurobi Write error
AnsweredHello,
So I'm trouble with the gurobi_write commands on matlab.
I'm running gurobi 9.5.1 and matlab R2021b and i cannot appear to use the the gurboi_write function. I've tried the code below sourced from the examples:
model.A = sparse([1 2 3; 1 1 0]);
model.obj = [1 1 2];
model.modelsense = 'max';
model.rhs = [4; 1];
model.sense = '<>';
gurobi_write(model, 'mymodel.mps');
gurobi_write(model, 'mymodel.lp');
gurobi_write(model, 'mymodel.mps.bz2');
The error I keep getting similar to my code is:
Error using gurobi_write
Gurobi error 10013: Unable to write to file 'mymodel.mps.bz2'
Error in gurwrite (line 8)
gurobi_write(model, 'mymodel.mps.bz2');
Can someone please explain what I'm doing wrong?
Thank You

Hi,
gurobi_write(model, 'mymodel.mps.bz2')
writes the model as mps and then compresses it. It is probably not necessary to use both commands:
gurobi_write(model, 'mymodel.mps');
gurobi_write(model, 'mymodel.mps.bz2');because both write the same mps file, the latter also compresses it.
You get the error because you do not have the appropriate compressing tool installed. So you need to install for example bzip2 or might use a different compression algorithm with a different file extension ('7z', 'zip').
Best regards,
Marika0
Please sign in to leave a comment.
Comments
1 comment