Class: Gecode::IntEnum::Count::CountConstraint

Inherits:
ReifiableConstraint show all
Defined in:
lib/gecoder/interface/constraints/int_enum/count.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from ReifiableConstraint

#&, #reification_var, #reification_var=, #|

Methods inherited from Constraint

#initialize

Constructor Details

This class inherits a constructor from Gecode::Constraint

Instance Method Details

#postObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/gecoder/interface/constraints/int_enum/count.rb', line 48

def post
  enum, element, relation_type, rhs = 
    @params.values_at(:enum, :element, :relation_type, :rhs)
  
  # Bind variables if needed.
  unless element.kind_of? Fixnum
    element = element.to_int_var.bind
  end
  unless rhs.kind_of? Fixnum
    rhs = rhs.to_int_var.bind
  end
  
  # Post the constraint to gecode.
  Gecode::Raw::count(@model.active_space, enum.to_int_enum.bind_array, 
    element, relation_type, rhs, *propagation_options)
end