MiniZinc / libminizinc

The MiniZinc compiler
http://www.minizinc.org
Other
519 stars 81 forks source link

`Assertion `typeId() == 0 || dim() == d' failed.` #826

Closed LebedevRI closed 2 months ago

LebedevRI commented 3 months ago

On debian sid:

$ dpkg -l | grep -i minizinc
ii  minizinc                                      2.8.3+dfsg1-1                                                 amd64        constraint modelling language and tool chain
ii  minizinc-ide                                  2.8.2-1+b1                                                    amd64        MiniZinc constraint modelling language IDE

... which seems a bit older than the newest release, so maybe it's fixed already?

predicate p(array[$$E] of var bool: b) =
  let {
    var bool: zero = not exists(b);
  } in 
    true;

enum SWITCHES = _(1..2);
array[SWITCHES] of var bool: v;

constraint p(v);
unreduced ``` include "link_set_to_booleans.mzn"; predicate link_var_to_booleans(var $$E: s, array[$$E] of var bool: b) = link_set_to_booleans({s}, b); % There doesn't seem to be a way to write this in terms of `link_var_to_booleans`. predicate link_var_to_booleans_or_zero(var $$I: s, array[$$E] of var bool: b) = let { constraint assert(not(0 in index_set(b)), ""); constraint assert(({0}++index_set(b)) == lb(s)..ub(s), ""); var index_set(b): t; var bool: zero = not exists(b); } in forall(i in index_set(b))( b[i] == (i == s) ); int: NUM_SWITCHES = 2; enum SWITCHES = _(1..NUM_SWITCHES); enum FRAMES = _(1..3); array[FRAMES,SWITCHES] of var bool: SwitchDrivePowerEnable; array[FRAMES] of var 0..NUM_SWITCHES: SwitchDrivePowerEnableIndex; constraint forall (f in FRAMES)( link_var_to_booleans_or_zero(SwitchDrivePowerEnableIndex[f], SwitchDrivePowerEnable[f,..]) ); ```
minizinc: ./include/minizinc/type.hh:148: void MiniZinc::Type::dim(int): Assertion `typeId() == 0 || dim() == d' failed.
guidotack commented 3 months ago

Seems to be fixed in the latest release. I'm a bit surprised that you get an assertion failure, which suggests that this is a debug build of MiniZinc. Is this just the standard Debian package?

LebedevRI commented 3 months ago

Yes, i'm also surprised that a standard debian package is built in non-Release build mode.