free-search being passed on to incompatible solvers
jmjrawlings opened this issue · 1 comments
I'm not sure if this is intended behaviour - but if you pass free_search=True
along to an instance whos solver does not support it a MiniZincError is thrown.
import minizinc as mz
solver = mz.Solver.lookup('coin-bc')
model = mz.Model()
model.add_string("var 1..10: a;")
instance = mz.Instance(solver, model)
solution = instance.solve(free_search=True)
It might be nicer for users that known unsupported command line arguments are not forwarded on to the minizinc, especially as experimenting with different solvers is common.
The workaround is to do something like:
solution = instance.solve(free_search='f' in solver.stdFlags and True)
This is intended behaviour, MiniZinc Python follows the same behaviour pattern as the MiniZinc executable.
Although I understand that it might often not matter whether free search is used or not, there is an important difference in solver behaviour. As such, I think that it should be up to the user to signal wether a difference should be made between the solvers that support and do not support free search.
Note that the workaround can be slightly simplified as the and True
statement does not do anything (maybe this was a variable in your original code):
solution = instance.solve(free_search='f' in solver.stdFlags)