# class Gecode::Set::Connection::SetSumOperand

### Public Instance Methods

constrain_equal(int_operand, constrain, propagation_options)
click to toggle source

# File doc/tmp/rdoc_dev/gecoder/interface/constraints/set/connection.rb, line 112 def constrain_equal(int_operand, constrain, propagation_options) set = @set.to_set_var lub = set.upper_bound.to_a lub.delete_if{ |e| @subs[e].nil? } substituted_lub = lub.map{ |e| @subs[e] } if constrain # Compute the theoretical bounds of the weighted sum. This is slightly # sloppy since we could also use the contents of the greatest lower # bound. min = substituted_lub.find_all{ |e| e < 0}.inject(0){ |x, y| x + y } max = substituted_lub.find_all{ |e| e > 0}.inject(0){ |x, y| x + y } int_operand.must_be.in min..max end Gecode::Raw::weights(@model.active_space, lub, substituted_lub, set.bind, int_operand.to_int_var.bind) end

### Public Class Methods

new(model, set_op, subs)
click to toggle source

Calls superclass method
Gecode::Int::ShortCircuitEqualityOperand.new

# File doc/tmp/rdoc_dev/gecoder/interface/constraints/set/connection.rb, line 106 def initialize(model, set_op, subs) super model @set = set_op @subs = subs end