In MiniZinc how can I resolve this error?

北战南征 提交于 2019-12-10 20:55:51

问题


In MiniZinc how can I get this code to compile without the error "no function or predicate with this signature found: `round(var float)'"?

var int: D = 1;
var int: F;
constraint F = round (D / 2);

回答1:


The message simply mean that MiniZinc don't have any support for round() with decision variables i.e. "round(var float)". It only support "round(float)" i.e. fixed float values. It's the same with ceil() and floor(), there is only support fixed float values.

MiniZinc 2.0 automatically converts the arguments division (/) to float division for the decision variables (which are thus not supported). However, since you are working with var int's you can try with integer division ("D div 2"), which give F = 0.

For MiniZinc 2.0 together with solvers that supports var float (e.g. G12/mip, JaCoP, Gecode and ECLiPSe): If you had defined F as "var float: F" then F would be 0.5. Note that G12/fd don't support var floats.



来源:https://stackoverflow.com/questions/28406318/in-minizinc-how-can-i-resolve-this-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!