class Gecode::Int::Arithmetic::IntMultOperand

Public Instance Methods

constrain_equal(int_operand, constrain, propagation_options) click to toggle source
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/int/arithmetic.rb, line 84
def constrain_equal(int_operand, constrain, propagation_options)
  int_op1, int_op2 = @op1.to_int_var, @op2.to_int_var
  if constrain
    a_min = int_op1.min; a_max = int_op1.max
    b_min = int_op2.min; b_max = int_op2.max
    products = [a_min*b_min, a_min*b_max, a_max*b_min, a_max*b_max]
    int_operand.must_be.in products.min..products.max
  end

  Gecode::Raw::mult(@model.active_space, int_op1.to_int_var.bind, 
    int_op2.to_int_var.bind, int_operand.to_int_var.bind, 
    *propagation_options)
end

Public Class Methods

new(model, op1, op2) click to toggle source
# File doc/tmp/rdoc_dev/gecoder/interface/constraints/int/arithmetic.rb, line 78
def initialize(model, op1, op2)
  super model
  @op1 = op1
  @op2 = op2
end