[英]MiniZinc 'WARNING: model inconsistency detected'
I've been getting a model inconsistency error from this constraint for quite some time now and can't figure out why it appears.很长一段时间以来,我一直从这个约束中得到一个模型不一致错误,但不知道为什么会出现这种错误。 I understand how a model inconsistency error occurs but do can't find out why it's happening here.我了解模型不一致错误是如何发生的,但不知道为什么会在这里发生。 Any help is much appreciated.任何帮助深表感谢。
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
)
);
The problem occurs because num_losses
cannot take on the value 0
.出现问题是因为num_losses
不能取值0
。 You could define a new zero-inclusive set as set of int: numberOfGames0=0..(length(games) div 2)
and redefine num_losses
as array[TEAMS] of var numberOfGames0: num_losses
;您可以将一个新的零包含集定义为一set of int: numberOfGames0=0..(length(games) div 2)
并将num_losses
重新定义为array[TEAMS] of var numberOfGames0: num_losses
;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.