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

constant folding in 2.1.4 #155

Closed
matsc-at-sics-se opened this Issue Mar 28, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@matsc-at-sics-se

matsc-at-sics-se commented Mar 28, 2017

Here are a couple of opportunities for constant folding. MiniZinc 2.1.4.

var int: X;
var int: Y;
var bool: sel;
var bool: dif;

constraint
  sel /\
  (sel -> X in 1..1) /\
  (sel -> Y in 2..2) /\
  X in 1..1 /\
  (Y != 2 <-> dif) /\
  Y != 3;

solve satisfy;

becomes:

var 1..1: X:: output_var;
var int: Y:: output_var;
var bool: dif:: output_var:: is_defined_var;
var bool: X_INTRODUCED_0_ ::var_is_introduced  = true;
var bool: X_INTRODUCED_1_ ::var_is_introduced  = true;
constraint int_ne(Y,3);
constraint int_ne_reif(Y,2,dif):: defines_var(dif);
constraint set_in(1,1..1);
constraint set_in(Y,2..2);
solve  satisfy;

And in a compiled bigger model I see many constraints on the form:

constraint bool_eq(X_INTRODUCED_3816_,X_INTRODUCED_186_);

and:

constraint array_bool_and([X_INTRODUCED_1756_],X_INTRODUCED_3254_):: defines_var(X_INTRODUCED_3254_);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment