【问题标题】:MiniZinc 'WARNING: model inconsistency detected'MiniZinc '警告:检测到模型不一致'
【发布时间】:2020-01-20 15:34:09
【问题描述】:

很长一段时间以来,我一直从这个约束中得到一个模型不一致错误,并且无法弄清楚它出现的原因。我了解模型不一致错误是如何发生的,但不知道为什么会在这里发生。非常感谢任何帮助。

int: n;
set of int: TEAMS=1..n;
array[int,int] of int: games;
set of int: pt={0,1,3};
set of int: numberOfGames=1..(length(games) div 2);
array[TEAMS] of var numberOfGames: num_losses;
array[numberOfGames, 1..2] of var pt: points;

constraint forall(i in TEAMS)(
  num_losses[i] = sum(j in numberOfGames where i=games[j,1]\/i=games[j,2])(
    if i=games[j,1] then
      (points[j,2] > 0)
    else
      (points[j,1] > 0)
    endif
  )
);

【问题讨论】:

    标签: constraint-programming minizinc


    【解决方案1】:

    出现问题是因为num_losses 无法采用值0。您可以将一个新的包含零的集合定义为set of int: numberOfGames0=0..(length(games) div 2),并将num_losses 重新定义为array[TEAMS] of var numberOfGames0: num_losses

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-03
      • 2020-05-06
      • 1970-01-01
      • 1970-01-01
      • 2011-02-03
      • 1970-01-01
      相关资源
      最近更新 更多