Logo
2.7.0
The MiniZinc Handbook
  • 1. Overview
  • 2. A MiniZinc Tutorial
  • 3. User Manual
  • 4. Reference Manual
    • 4.1. Specification of MiniZinc
    • 4.2. The MiniZinc library
      • 4.2.1. Standard Library
      • 4.2.2. Global constraints
        • 4.2.2.1. All-Different and related constraints
        • 4.2.2.2. Lexicographic constraints
        • 4.2.2.3. Sorting constraints
        • 4.2.2.4. Channeling constraints
        • 4.2.2.5. Counting constraints
        • 4.2.2.6. Array-related constraints
        • 4.2.2.7. Set-related constraints
        • 4.2.2.8. Mathematical constraints
        • 4.2.2.9. Packing constraints
        • 4.2.2.10. Scheduling constraints
        • 4.2.2.11. Graph constraints
        • 4.2.2.12. Extensional constraints (table, regular etc.)
        • 4.2.2.13. Machine learning constraints
        • 4.2.2.14. Deprecated constraints
      • 4.2.3. FlatZinc builtins
      • 4.2.4. Additional declarations for Gecode
      • 4.2.5. Additional declarations for Chuffed
      • 4.2.6. MiniZincIDE tools
    • 4.3. Interfacing Solvers to Flatzinc
    • 4.4. Machine-readable JSON output format
The MiniZinc Handbook
  • Docs »
  • 4. Reference Manual »
  • 4.2. The MiniZinc library »
  • 4.2.2. Global constraints »
  • 4.2.2.1. All-Different and related constraints

4.2.2.1. All-Different and related constraints¶

In this section: all_different, all_different_except, all_different_except_0, all_disjoint, all_equal, nvalue, symmetric_all_different.

all_different¶

1.  predicate all_different(array [$X] of var int: x)

2.  predicate all_different(array [$X] of var set of int: x)

3.  predicate all_different(array [$X] of var opt int: x)
1, 2.
Constrain the elements in the array x to be pairwise different.
  1. Constrain the non-absent elements in the array x to be pairwise different. The absent value <> is allowed to occur multiple times.

all_different_except¶

predicate all_different_except(array [$X] of var int: vs,
                               set of int: S)
Constrain the elements of the array of integers vs to be pairwise different except for those values that appear in the set S.

all_different_except_0¶

predicate all_different_except_0(array [$X] of var int: vs)
Constrain the elements of the array of integers vs to be pairwise different except for those elements that are assigned the value 0.

all_disjoint¶

predicate all_disjoint(array [$X] of var set of int: S)
Constrain the array of sets of integers S to be pairwise disjoint.

all_equal¶

predicate all_equal(array [$X] of var int: x)
predicate all_equal(array [$X] of var set of int: x)
Constrain the elements of the array x to be all equal.

nvalue¶

1.  predicate nvalue(var int: n, array [$X] of var int: x)

2.  function var int: nvalue(array [$X] of var int: x)
  1. Requires that the number of distinct values in x is n.

  2. Returns the number of distinct values in x.

symmetric_all_different¶

predicate symmetric_all_different(array [int] of var int: x)
Requires the array of integers x to be all different, and for all i, x[i]=j \(\rightarrow\) x[j]=i.
Next Previous

© Copyright 2016, 2017, 2018, 2019, 2020 Peter J. Stuckey, Kim Marriott, Guido Tack.

Creative Commons License