Logo
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.2.7. MiniZinc definitions for the MiniZinc diversity extension.
      • 4.2.8. Experimental Features
    • 4.3. Interfacing Solvers to Flatzinc
    • 4.4. Machine-readable JSON output format
The MiniZinc Handbook
  • 4. Reference Manual
  • 4.2. The MiniZinc library
  • 4.2.2. Global constraints
  • 4.2.2.7. Set-related constraints

4.2.2.7. Set-related constraints

In this section: disjoint, partition_set, roots.

disjoint

predicate disjoint(var set of $$E: s, var set of $$E: t)

Requires that sets s and t do not intersect.

partition_set

predicate partition_set(array [$X] of var set of $$E: xs,
                        set of $$E: universe)

Constrains the sets in array xs to partition the universe.

roots

1.  predicate roots(array [$$X] of var $$Y: xs,
                    var set of $$X: preimage,
                    var set of $$Y: image)

2.  function var set of $$X: roots(array [$$X] of var $$Y: xs,
                                   var set of $$Y: image)
  1. Requires that xs[i] in image for all i in preimage, i.e. preimage is the set of indices i for which xs[i] is in image.

  2. Returns the set of indices i such that xs[i] is in image.

Previous Next

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

Creative Commons License