Class: Gecode::Constraints::Set::Relation::RelationConstraint
- Inherits:
-
ReifiableConstraint
- Object
- Constraint
- ReifiableConstraint
- Gecode::Constraints::Set::Relation::RelationConstraint
- Defined in:
- lib/gecoder/interface/constraints/set/relation.rb
Overview
Describes a relation constraint which constrains a set variable to have a specified relation to another set variable. The allowed relations and their aliases are
-
subset, subset_of
-
superset, superset_of
-
disjoint, disjoint_with
-
complement, complement_of
Examples
# +set_1+ must be subset of +set_2+
set_1.must_be.subset_of set_2
# +set_1+ must not be superset of +set_2+
set_1.must_not_be.superset_of set_2
# +set_1+ must be disjoint with +set_2+
set_1.must_be.disjoint set_2
# The same as above but reified with the boolean variable
# +are_disjoint+.
set_1.must_be.disjoint(set_2, :reify => are_disjoint)
Instance Method Summary collapse
Methods inherited from ReifiableConstraint
#&, #reification_var, #reification_var=, #|
Methods inherited from Constraint
Constructor Details
This class inherits a constructor from Gecode::Constraints::Constraint
Instance Method Details
#post ⇒ Object
110 111 112 113 114 115 116 117 118 119 |
# File 'lib/gecoder/interface/constraints/set/relation.rb', line 110 def post var, rhs, reif_var, relation = @params.values_at(:lhs, :rhs, :reif, :relation) (params = []) << var.bind params << Gecode::Constraints::Util::SET_RELATION_TYPES[relation] params << rhs.bind params << reif_var.bind if reif_var.respond_to? :bind Gecode::Raw::rel(@model.active_space, *params) end |