Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LebedevRI opened this issue Jul 29, 2024 · 2 comments
Open

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

LebedevRI opened this issue Jul 29, 2024 · 2 comments
Labels
bug resolved Issue is resolved and the feature or fix will be part of next release

Comments

@LebedevRI
Copy link

LebedevRI commented Jul 29, 2024

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
Copy link
Member

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
Copy link
Author

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

@cyderize cyderize added the bug label Jul 30, 2024
@cyderize cyderize added the resolved Issue is resolved and the feature or fix will be part of next release label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug resolved Issue is resolved and the feature or fix will be part of next release
Projects
None yet
Development

No branches or pull requests

3 participants