Sha256: d51e5252ce34154d802e442c83ec312db2d83c04bafced5b9f97538687e1f524

Contents?: true

Size: 847 Bytes

Versions: 15

Compression:

Stored size: 847 Bytes

Contents

module Gecode
  class FreeBoolVar
    # Creates a linear expression where the bool variables are summed.
    def +(var)
      Gecode::Constraints::Int::Linear::ExpressionNode.new(self, 
        @model) + var
    end
    
    alias_method :pre_linear_mult, :* if instance_methods.include? '*'

    # Creates a linear expression where the bool variable is multiplied with 
    # a constant integer.
    def *(int)
      if int.kind_of? Fixnum
        Gecode::Constraints::Int::Linear::ExpressionNode.new(self, 
          @model) * int
      else
        pre_linear_mult(int) if respond_to? :pre_linear_mult
      end
    end
    
    # Creates a linear expression where the specified variable is subtracted 
    # from this one.
    def -(var)
      Gecode::Constraints::Int::Linear::ExpressionNode.new(self, 
        @model) - var
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
gecoder-with-gecode-0.8.3-mswin32 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-with-gecode-0.8.2-mswin32 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-with-gecode-0.8.1-mswin32 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-with-gecode-0.8.0-mswin32 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-with-gecode-0.7.1-mswin32 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-0.8.3 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-0.8.1 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-0.8.0 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-0.8.2 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-0.7.1 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-with-gecode-0.7.1 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-with-gecode-0.8.0 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-with-gecode-0.8.1 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-with-gecode-0.8.2 lib/gecoder/interface/constraints/bool/linear.rb
gecoder-with-gecode-0.8.3 lib/gecoder/interface/constraints/bool/linear.rb