Search code examples
constraint-programmingminizinc

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
  )
);

Solution

  • The problem occurs because num_losses cannot take on the value 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;