Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spaces required between solver options? #199

Open
4er4er4er opened this issue Feb 7, 2023 · 3 comments
Open

Spaces required between solver options? #199

4er4er4er opened this issue Feb 7, 2023 · 3 comments
Assignees

Comments

@4er4er4er
Copy link
Contributor

Using ASL solvers, it was possible to specify an option string that had no space between option specifications. A user has provided this minimal example:

var x;

minimize Obj: x;
subject to Bound: x>=0;

option solver gurobiasl;
option gurobi_options 'outlev 0';
option gurobi_options $gurobi_options 'presolve 0';

solve;
option gurobi_options;

which gives a succesful Gurobi 10.0 run, even though it reports the option string to be 'outlev 0presolve 0'. When run with the MP-based Gurobi version, however, this example rejects the option string:

option gurobi_options;
Gurobi 10.0.0: Invalid value "0presolve" for option "tech:outlev"
Unknown option or invalid key "0"
tech:outlev=0
exit value 1
<BREAK>

The user was concerned because his old scripts were breaking when he tried to use them with the MP version, and he had to change to, for example,

option gurobi_options 'outlev 0';
option gurobi_options $gurobi_options ' presolve 0';

Should we try to reproduce ASL's option processing (without spaces) in MP, or should we declare that it was an undocumented feature of ASL that we have chosen not to perpetuate?

@fdabrandao
Copy link
Member

I think we should declare that it was an undocumented featured of ASL since the space should ideally be included every time. Otherwise we also get situations like the following:

option gurobi_options 'outlev=1 writeprob=model.lp';
option gurobi_options $gurobi_options 'presolve 0';

This does not work with both gurobi and gurobiasl since it becomes "outlev=1 writeprob=model.lppresolve 0".

@glebbelov
Copy link
Contributor

Would it be clean to always insert a space when appending to AMPL option value?

@4er4er4er
Copy link
Contributor Author

I think this could work for solver options, with very low probability of breaking any existing scripts. However, a potential problem is that AMPL's option command does not know the difference between setting a solver option string and setting any other option, and thus it would also add spaces in other contexts, like this:

ampl: option directory "/usr/4er";
ampl: option filename1 "diet.mod";
ampl: option file $directory "/" $filename1;

ampl: option file;
option file '/usr/4er/diet.mod';

We could try to arrange to only add spaces when the option name ends in _options, but that would be kludgy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants