Class: Gecode::Set::Connection::SetMaxOperand

Inherits:
Int::ShortCircuitEqualityOperand show all
Defined in:
lib/gecoder/interface/constraints/set/connection.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Int::ShortCircuitEqualityOperand

#model

Instance Method Summary collapse

Methods inherited from Int::ShortCircuitEqualityOperand

#construct_receiver, #to_int_var

Methods included from Int::IntOperand

#*, #+, #-, #abs, #method_missing, #pre_arith_mult, #square_root, #squared

Methods included from Operand

#model, #must, #must_not

Constructor Details

#initialize(model, set_op) ⇒ SetMaxOperand

Returns a new instance of SetMaxOperand.



89
90
91
92
# File 'lib/gecoder/interface/constraints/set/connection.rb', line 89

def initialize(model, set_op)
  super model
  @set = set_op
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gecode::Int::IntOperand

Instance Method Details

#constrain_equal(int_operand, constrain, propagation_options) ⇒ Object



94
95
96
97
98
99
100
101
102
# File 'lib/gecoder/interface/constraints/set/connection.rb', line 94

def constrain_equal(int_operand, constrain, propagation_options)
  set = @set.to_set_var
  if constrain
    int_operand.must_be.in set.upper_bound.min..set.lower_bound.min
  end
  
  Gecode::Raw::max(@model.active_space, set.bind, 
    int_operand.to_int_var.bind)
end