Class: Gecode::SetEnum::Operation::OperationSetOperand

Inherits:
Gecode::Set::ShortCircuitEqualityOperand show all
Defined in:
lib/gecoder/interface/constraints/set_enum/operation.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Gecode::Set::ShortCircuitEqualityOperand

#model

Instance Method Summary collapse

Methods inherited from Gecode::Set::ShortCircuitEqualityOperand

#construct_receiver, #to_set_var

Methods included from Gecode::Set::SetOperand

#disjoint_union, #elements, #intersection, #method_missing, #minus, #size, #union

Methods included from Operand

#model, #must, #must_not

Constructor Details

#initialize(model, enum, operator) ⇒ OperationSetOperand

:nodoc:



48
49
50
51
52
# File 'lib/gecoder/interface/constraints/set_enum/operation.rb', line 48

def initialize(model, enum, operator)
  super model
  @enum = enum
  @operator = operator
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gecode::Set::SetOperand

Instance Method Details

#constrain_equal(set_operand, constrain_domain, propagation_options) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/gecoder/interface/constraints/set_enum/operation.rb', line 54

def constrain_equal(set_operand, constrain_domain, propagation_options)
  operation = Gecode::Util::SET_OPERATION_TYPES[@operator]
  if constrain_domain
    if operation == Gecode::Raw::SOT_INTER
      set_operand.must_be.subset_of @enum.first.upper_bound
    else
      set_operand.must_be.subset_of @enum.upper_bound_range
    end
  end
  
  Gecode::Raw::rel(@model.active_space, operation, 
    @enum.to_set_enum.bind_array, set_operand.to_set_var.bind)
end