Question

Is there any way (direct or indirect) by which pow constraints can be supported in minizinc. Gecode supports the pow constraint with float and int variables, however Minizinc and FlatZinc does not support pow for variables. Minizinc and Flatzinc supports pow only for parameters to the model. Any pointers on where to look to add support in MiniZinc to Flatzinc (mzn2fzn) parser to do this.

I want to have a constraint such as - " pow( 4, x ) == y " , i.e. 4^x == y .

Was it helpful?

Solution

What I know it's not possible in current version of MiniZinc to use pow/2 with decision variables.

Perhaps it would be enough to emulate it with "exists"? Here's a simple example (the domain of "i" is too large in this example).

var 0..10000: x;
var 0..10000: y;
solve satisfy;

constraint
      exists(i in lb(x)..ub(x)) (
         i = x /\
         pow(4,i) = y
      )
;

output [ show([x,y]) ];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top