Error: syntax error, unexpected any; when using OR-Tools solver with Minizinc

Error: syntax error, unexpected any; when using OR-Tools solver with Minizinc

我想将 OR-Tools 求解器与 MiniZinc(IDE 或 CLI)结合使用。 我按照 . My MiniZincIDE is now set up like this: .

中的步骤操作

当我 select OR 工具求解器并尝试在简单的 .mzn 模型上 运行 它时,我收到以下错误:

(included from file '/home/my_username/lib/MiniZincIDE-2.5.5-bundle-linux-x86_64/share/minizinc/std/solver_redefinitions.mzn')
/home/my_username/lib/MiniZincIDE-2.5.5-bundle-linux-x86_64/bin/or-tools/share/minizinc/redefinitions-2.0.mzn:104.9-11:
        any: xx = [ x[i] | i in index_set(x) where occurs(v[i])];
        ^^^
Error: syntax error, unexpected any
(included from file '/home/my_username/lib/MiniZincIDE-2.5.5-bundle-linux-x86_64/share/minizinc/std/solver_redefinitions.mzn')
/home/my_username/lib/MiniZincIDE-2.5.5-bundle-linux-x86_64/bin/or-tools/share/minizinc/redefinitions-2.0.mzn:111.9-11:
        any: xx = [ x[i] | i in index_set(x) where occurs(v[i])];
        ^^^
Error: syntax error, unexpected any

Process finished with non-zero exit code 1

我该如何解决这个问题?

OR-tools FlatZinc 的版本与您安装的 MiniZinc 版本(2.5.5 版)之间存在冲突。 FlatZinc 定义中的 any 关键字至少需要 MiniZinc 版本 2.6.0。

如果您将 MiniZinc 更新到当前版本,它应该可以工作。