Class: Gecode::SelectedSet::Element::SelectedSetIntersectionOperand

Inherits:
Gecode::Set::ShortCircuitEqualityOperand show all
Defined in:
lib/gecoder/interface/constraints/selected_set/select.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, #max, #method_missing, #min, #minus, #size, #sum, #union

Methods included from Operand

#model, #must, #must_not

Constructor Details

#initialize(model, selected_set, universe) ⇒ SelectedSetIntersectionOperand

Returns a new instance of SelectedSetIntersectionOperand.



86
87
88
89
90
# File 'lib/gecoder/interface/constraints/selected_set/select.rb', line 86

def initialize(model, selected_set, universe)
  super model
  @selected_set = selected_set
  @universe = universe
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, propagation_options) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/gecoder/interface/constraints/selected_set/select.rb', line 92

def constrain_equal(set_operand, constrain, propagation_options)
  enum, indices = @selected_set.to_selected_set
  universe = @universe

  # We can't do any useful constraining here since the empty intersection
  # is the universe.

  if universe.nil?
    Gecode::Raw::elementsInter(@model.active_space, 
      enum.to_set_enum.bind_array, indices.to_set_var.bind, 
      set_operand.to_set_var.bind)
  else
    Gecode::Raw::elementsInter(@model.active_space,  
      enum.to_set_enum.bind_array, indices.to_set_var.bind, 
      set_operand.to_set_var.bind,
      Gecode::Util.constant_set_to_int_set(universe))
  end
end