Class: Gecode::Constraints::Int::Domain::RangeDomainConstraint
- Inherits:
-
ReifiableConstraint
- Object
- Constraint
- ReifiableConstraint
- Gecode::Constraints::Int::Domain::RangeDomainConstraint
- Defined in:
- lib/gecoder/interface/constraints/int/domain.rb
Overview
Range domain constraints specify that an integer variable must be contained within a specified range of integers. Supports reification and negation.
Examples
# +x+ must be in the range 1..10
x.must_be.in 1..10
# +x+ must not be in the range -5...5
x.must_not_be.in -5...5
# Specifies the above, but but reifies the constraint with the boolean
# variable +bool+ and specified +value+ as strength.
x.must_not_be.in(-5...5, :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
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gecoder/interface/constraints/int/domain.rb', line 36 def post var, domain, reif_var = @params.values_at(:lhs, :domain, :reif) (params = []) << var.bind params << domain.first << domain.last params << reif_var.bind if reif_var.respond_to? :bind params.concat Gecode::Raw::dom(@model.active_space, *params) end |