Class: Gecode::SelectedSet::Element::SelectedSetUnionOperand

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, #method_missing, #minus, #size, #union

Methods included from Operand

#model, #must, #must_not

Constructor Details

#initialize(model, selected_set) ⇒ SelectedSetUnionOperand

Returns a new instance of SelectedSetUnionOperand.



68
69
70
71
# File 'lib/gecoder/interface/constraints/selected_set/select.rb', line 68

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



73
74
75
76
77
78
79
80
81
82
# File 'lib/gecoder/interface/constraints/selected_set/select.rb', line 73

def constrain_equal(set_operand, constrain, propagation_options)
  enum, indices = @selected_set.to_selected_set
  if constrain
    set_operand.must_be.subset_of enum.upper_bound_range
  end
  
  Gecode::Raw::elementsUnion(@model.active_space, 
    enum.to_set_enum.bind_array, indices.to_set_var.bind, 
    set_operand.to_set_var.bind)
end