![](/img/trans.png)
[英]MiniZinc: type error: no function or predicate with this signature found: `floor(var int)'
[英]MiniZinc: type error: no function or predicate with this signature found: `cost(var int,var int)'
int: W;
set of int: COL = 1..W;
int: H;
set of int: ROW = 1..H;
array[ROW,COL] of int: cost;
int: budget;
array[1..budget] of var COL: x;
array[1..budget] of var ROW: y;
array[1..budget] of int: c;
...
constraint forall(i in 1..budget)(c[i]=cost(x[i],y[i]));
Minizinc 有一個約束類型錯誤報告:沒有找到具有此簽名的函數或謂詞:`cost(var int,var int)'。 如何使用 x,y 將數組成本中的值分配給數組 c?
cost
被聲明為一個數組,而不是一個函數。 這意味着 MiniZinc 期望您使用方括號使用它,即cost[x[i], y[i]]
。 因為您目前正在使用括號 MiniZinc 認為cost(x[i],y[i])
是一個函數調用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.