Set Enumeration Operands

An set enumeration operand is an enumeration of set operands.

Examples of Set Enumeration Operands

Enumerations of set operands are commonly created using Gecode::Mixin#set_var_array and Gecode::Mixin#set_var_matrix.

# Creates an array of five set operands, with greatest lower bound
# {0} and least upper bound {0, 1, 2}.
set_enum = set_var_array(5, 0, 1..2)

A less common way to create the operands is by using Gecode::Mixin#wrap_enum to wrap an existing enumeration that contains set operands.

set_enum = wrap_enum([set_operand1, set_operand2])

Constraints

Generated from SetEnumConstraintReceiver.

channel

channel(enum, options = {})

Constrains this set enum to channel int_enum_operand. The i:th set in the enumeration of set operands is constrained to include the value of the j:th integer operand.

Neither reification nor negation is supported.

Examples
# +set_enum+ is constrained to channel +int_enum+.
int_enum.must.channel set_enum

# This is another way of writing the above.
set_enum.must.channel int_enum

at_most_share_one_element

at_most_share_one_element(options = {})

Constrains all pairs of set operands in the enumeration to at most have one element in common and be of a specified size. Providing a size is not optional.

Neither negation nor reification is supported.

Examples
# All set operands in +sets+ must have cardinality 17 and no pair may
# have more than one element in common.
sets.must.at_most_share_one_element(:size => 17)

Properties

Generated from SetEnumOperand.

[]

[](*vars)

Produces a SetOperand representing the i:th set operand in the enumeration, where i is the value of the int operand used as index.

A set can also be used as index, in which case a SelectedSetOperand is produced.

Examples
# The set operand at the +x+:th position in +set_enum+,
# where +x+ is a int operand.
set_enum[x]

# The SelectedSetOperand representing sets at positions
# included in the value of +set+ in +set_enum+,
set_enum[set]

union

union()

Produces a SetOperand representing the union of all sets in this enumeration.

Examples
# The union of all sets in +set_enum+.
set_enum.union

intersection

intersection()

Produces a SetOperand representing the intersection of all sets in this enumeration.

Examples
# The intersection of all sets in +set_enum+.
set_enum.intersection

disjoint_union

disjoint_union()

Produces a SetOperand representing the disjoint union of all sets in this enumeration.

Examples
# The disjoint union of all sets in +set_enum+.
set_enum.disjoint_union