title: How can I simulate breaking loops in Minizinc?
body: <p>I have an array of variables called LIST. That can be indexed from 1 to tMax, and it can assume values from an enum called SYMB.</p>
  
  <p>My objective is minimize the max distance between same occurrences of SYMB in LIST. </p>
  
  <p>For example, if LIST = {S1, S2, S1, S3, S2, S1}.</p>
  
  <p>S1: maximum distance is 3. The S1 in position 3 and S1 in position 6.</p>
  
  <p>S2: maximum distance is 3. The S1 in position 2 and S1 in position 5.</p>
  
  <p>S3: maximum distance is 0. It only has 1 occurrence of S3.</p>
  
  <pre><code>int: tMax;
  enum SYMB;
  array[1..tMax] of var SYMB: LIST;
  var int: obj;
  
  constraint forall(i in 1..tMax, j in i+1..tMax 
               where LIST[i] = LIST[j]) 
                         (obj = max( abs (i - j) , obj) );
  solve minimize obj;
  </code></pre>
  
  <p>However, this code is considering the distance from the first occurrence of S1 in position 1, and last occurrence of S1 in position 6, so the distance is 5.</p>
  
  <p>I would like to know if it is possible, and how to do, to check only the first occurrence between same SYMB. S1 from the index 1 compared with S1 from the index 3, and S1 from index 3 compared with S1 from index 6. </p>
  
  <p>It's a kind of 'break' the internal loop after the first comparison.</p>
  
  <p>Thank you all.</p>