【问题标题】:MiniZinc: type error: no function or predicate with this signature found: `cost(var int,var int)'MiniZinc:类型错误:找不到具有此签名的函数或谓词:`cost(var int,var int)'
【发布时间】:2020-03-29 16:09:00
【问题描述】:
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?

【问题讨论】:

    标签: minizinc


    【解决方案1】:

    cost 被声明为数组,而不是函数。这意味着 MiniZinc 希望您使用方括号来使用它,即cost[x[i], y[i]]。因为你当前使用的是括号 MiniZinc 认为cost(x[i],y[i]) 是一个函数调用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-19
      • 1970-01-01
      • 2010-09-24
      • 1970-01-01
      • 1970-01-01
      • 2021-09-11
      相关资源
      最近更新 更多