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 -
I currently have the same error in matlab 2024b on win 11 and not one compression tool works. 7z is installed and zip support is shipped with windows as a standrad right? On linux, using the latest matlab/gurobi combination, this works.
0 -
Error message when trying the same in gurobi_cl:
Error: No compression tool available to open .\xxxxxx.mps.7z, please install "7-zip"
but I have "C:\Program Files\7-Zip\7z.exe" available...0 -
Hi Felix,
Can you test whether 7 zip works from the command line (i.e. try `7z -h`)? You may have it installed but Gurobi needs to be able to know it exists, and I expect this should test whether it will be found.
If it doesn't work from the command line then I'd suggest adding "C:\Program Files\7-Zip" to your PATH environment variable, then restarting a shell and trying again with gurobi_cl.
- Riley
0
Please sign in to leave a comment.
Comments
4 comments