Class: Gecode::Set::Operation::OperationConstraint

Inherits:
Constraint
  • Object
show all
Defined in:
lib/gecoder/interface/constraints/set/operation.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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/gecoder/interface/constraints/set/operation.rb', line 99

def post
  op1, op2, operation, relation, rhs, negate = @params.values_at(:op1, 
    :op2, :operation, :relation_type, :rhs, :negate)

  op1, op2, rhs = [op1, op2, rhs].map do |expression|
    # The expressions can either be set operands or constant sets, 
    # convert them appropriately.
    if expression.respond_to? :to_set_var
      expression.to_set_var.bind
    else
      Gecode::Util::constant_set_to_int_set(expression)
    end
  end

  Gecode::Raw::rel(@model.active_space, op1, operation, op2, 
    relation, rhs)
end