Class: Gecode::Constraints::Int::Expression
- Inherits:
-
Expression
- Object
- Expression
- Gecode::Constraints::Int::Expression
- Defined in:
- lib/gecoder/interface/constraints/int/domain.rb,
lib/gecoder/interface/constraints/int/linear.rb,
lib/gecoder/interface/constraints/int_var_constraints.rb
Instance Method Summary collapse
-
#in(domain, options = {}) ⇒ Object
Creates a domain constraint using the specified domain.
-
#initialize(model, params) ⇒ Expression
constructor
A new instance of Expression.
-
#pre_linear_initialize ⇒ Object
Add some relation selection based on whether the expression is negated.
Constructor Details
#initialize(model, params) ⇒ Expression
Returns a new instance of Expression.
33 34 35 36 37 38 39 40 |
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 33 def initialize(model, params) pre_linear_initialize(model, params) unless params[:negate] @method_relations = Constraints::Util::RELATION_TYPES else @method_relations = Constraints::Util::NEGATED_RELATION_TYPES end end |
Instance Method Details
#in(domain, options = {}) ⇒ Object
Creates a domain constraint using the specified domain.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/gecoder/interface/constraints/int/domain.rb', line 4 def in(domain, = {}) @params.update(Gecode::Constraints::Util.()) @params[:domain] = domain if domain.kind_of? Range @model.add_constraint Domain::RangeDomainConstraint.new(@model, @params) else @model.add_constraint Domain::NonRangeDomainConstraint.new(@model, @params) end end |
#pre_linear_initialize ⇒ Object
Add some relation selection based on whether the expression is negated.
32 |
# File 'lib/gecoder/interface/constraints/int/linear.rb', line 32 alias_method :pre_linear_initialize, :initialize |