Class: Gecode::Constraints::Set::Relation::EqualityRelationConstraint
- Inherits:
-
ReifiableConstraint
- Object
- Constraint
- ReifiableConstraint
- Gecode::Constraints::Set::Relation::EqualityRelationConstraint
- Defined in:
- lib/gecoder/interface/constraints/set/relation.rb
Overview
Describes a relation constraint which constrains a set variable to be equal to another set variable. Equality may either be expressed as ==, equal
or equal_to
.
Examples
# +set_1+ must be equal to +set_2+
set_1.must == set_2
# +set_1+ must not be equal to +set_2+
set_1.must_not == set_2
# The same as above but reified with the boolean variable
# +are_not_equal+.
set_1.must_not.equal(set_2, :reify => are_not_equal)
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
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/gecoder/interface/constraints/set/relation.rb', line 69 def post var, rhs, reif_var, negate = @params.values_at(:lhs, :rhs, :reif, :negate) if negate rel_type = Gecode::Constraints::Util::NEGATED_SET_RELATION_TYPES[:==] else rel_type = Gecode::Constraints::Util::SET_RELATION_TYPES[:==] end (params = []) << var.bind params << rel_type params << rhs.bind params << reif_var.bind if reif_var.respond_to? :bind Gecode::Raw::rel(@model.active_space, *params) end |