Class: Gecode::BoolEnum::Extensional::TupleConstraint

Inherits:
Constraint
  • Object
show all
Defined in:
lib/gecoder/interface/constraints/bool_enum/extensional.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Constraint

#initialize

Constructor Details

This class inherits a constructor from Gecode::Constraint

Instance Method Details

#postObject

:nodoc:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/gecoder/interface/constraints/bool_enum/extensional.rb', line 81

def post
  # Bind lhs.
  lhs = @params[:lhs].to_bool_enum.bind_array

  # Create the tuple set.
  tuple_set = Gecode::Raw::TupleSet.new
  @params[:tuples].each do |tuple|
    tuple_set.add tuple.map{ |b| b ? 1 : 0 }
  end
  tuple_set.finalize

  # Post the constraint.
  Gecode::Raw::extensional(@model.active_space, lhs, tuple_set, 
    *propagation_options)
end