Class: Gecode::Constraints::Int::Domain::EnumDomainConstraint
- Inherits:
-
ReifiableConstraint
- Object
- Constraint
- ReifiableConstraint
- Gecode::Constraints::Int::Domain::EnumDomainConstraint
- Defined in:
- lib/gecoder/interface/constraints/int/domain.rb
Overview
Enum domain constraints specify that an integer variable must be contained in an enumeration of integers. Supports reification and negation.
Examples
# +x+ must be in the enumeration [3,5,7].
x.must_be.in [3,5,7]
# +x+ must not be in the enumeration [5,6,7,17].
x.must_not_be.in [5,6,7,17]
# Specifies the above, but but reifies the constraint with the boolean
# variable +bool+ and specified +value+ as strength.
x.must_not_be.in(-[5,6,7,17], :reify => bool, :strength => :value)
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
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/gecoder/interface/constraints/int/domain.rb', line 64 def post var, domain, reif_var = @params.values_at(:lhs, :domain, :reif) (params = []) << var.bind params << Gecode::Constraints::Util.constant_set_to_int_set(domain) params << reif_var.bind if reif_var.respond_to? :bind params.concat Gecode::Raw::dom(@model.active_space, *params) end |