class Gecode::Int::Arithmetic::IntSquaredOperand

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 105
def constrain_equal(int_operand, constrain, propagation_options)
  int_op = @int.to_int_var
  if constrain
    min = int_op.min; max = int_op.max
    products = [min*max, min*min, max*max]
    int_operand.must_be.in products.min..products.max
  end

  Gecode::Raw::sqr(@model.active_space, int_op.to_int_var.bind, 
    int_operand.to_int_var.bind, *propagation_options)
end

Public Class Methods

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