gurobi .sol file returns the default name of variables rather than the customised
Answered-
My guess is that you have at least one variable name with some non-standard character (like a space or a Greek letter), and thus Gurobi decides that it cannot produce a *.sol that can already be read back. Older versions of Gurobi didn't have this check and would sometimes create *.sol files that, when read in, either produce an error message or, even worse, interpret this as a different solution.
Regards,
Tobias
0 -
Thank you for your prompt response. Actually I do have variables called using Greek letters (for example Σ for SUMs). Before I change the naming, I have only one question more. This feature exists only for .sol files, and not for .lp? I ask because, the .lp file is generated, as it should.
So, if I understand correctly, I will have to change the variables names, in order to include only valid symbols. Which symbols are considered as valid?
Thank you very much,
Best regards,
Stella
0 -
It is a bit strange that the *.lp file is written with your names, because the LP file writer is using the exact same method to check variable names as the *.sol file writer.
Note also that you should get a warning message when writing a file with invalid names, and the warning message should give you some hint which of the names caused an issue.
Gurobi always uses standard ASCII encoding when checking name strings and check each character. A name must not contain spaces ' ' and colons ':'. Other than this, there should be no restriction. But of course, having things like tabs or newlines in the name will probably also cause issues.
But note that your Greek letters are probably encoded using multiple bytes. Hence, it could be that an encoding of such a letter contains a byte that corresponds to a space or a colon, and then Gurobi will reject it.
Note also that you must give a name to every single variable, and you must not have duplicates in your names.
Regards,
Tobias
0 -
Hello again!
My problem is finally solved,. Actually the "ΣQ"s vars where not the problem, but a duplicate name in variables as you mentioned above.
I just want to ask, if there is a warning "constraint name ... has a space" but the model is solved does that may affect the model development and therefore the solution.
Additionally, as far as my model is solved and the "ΣQ" vars are "seen" correctly in the solution file does that may affect the model and therefore I should change the names respectively or is it ok?
Thank you very very much for helping.
Best regards,
Stella.
0 -
Hi Stella,
These warnings don't produce a wrong solution, because Gurobi will ignore the names when solving the problem. The only question is, if you can extract a solution and interpret the meaning if there was an issue with any of the names. The constraint names are less problematic, if you are only looking at the variables values after a solving run.
Best regards,
Sonja
0 -
Good morning! Super then, everything works fine!
Thank you so much for helping!
Have a nice August!
Best,
Stella
0
Please sign in to leave a comment.
Comments
6 comments