minizinc "span" global constraint example

45 views Asked by At

I was trying to write down a simple MiniZinc example of using span global constraint because I couldn't find any examples.

include "span.mzn";

% Optional task start time that we'll trying to find
var opt int: s0;

% Optional task is 30 minutes
var int: d0 = 30;

% Notice absent slot of 120 minutes that's more than enough for our 30 minutes task
array[1..3] of var opt int: s = [0, <>, 165];
array[1..3] of var int: d = [45, 120, 145];


constraint span(s0, d0, s, d);

solve satisfy;
% Expected to be/start at 45?
output [ "s0 = \(s0)"];

The error I'm getting is:

/usr/share/minizinc/std//stdlib/stdlib_math.mzn:227:
  in if-then-else expression
  in call 'forall'
  in array comprehension expression
    with i = 2
  in binary '>=' operator expression
  in call 'deopt'
  ambiguous overloading on return type of function

How to fix this example to become a minimum viable example of using span constraint?

0

There are 0 answers