class Ilp::Var
Constants
- BINARY_KIND
- CONTINUOUS_KIND
- INTEGER_KIND
Attributes
kind[RW]
lower_bound[RW]
name[RW]
upper_bound[RW]
Public Class Methods
new(name: nil, kind: INTEGER_KIND, lower_bound: nil, upper_bound: nil)
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 9 def initialize(name: nil, kind: INTEGER_KIND, lower_bound: nil, upper_bound: nil) @kind = kind @name = name @name = ("a".."z").to_a.sample(8).join if name.nil? @lower_bound = lower_bound @upper_bound = upper_bound end
Public Instance Methods
*(other)
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 38 def *(other) Ilp::Term.new(self) * other end
+(other)
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 26 def +(other) Ilp::Term.new(self) + other end
-(other)
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 30 def -(other) Ilp::Term.new(self) - other end
-@()
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 34 def -@ Ilp::Term.new(self, -1) end
<=(other)
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 46 def <=(other) Ilp::Term.new(self) <= other end
==(other)
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 42 def ==(other) Ilp::Term.new(self) == other end
>=(other)
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 50 def >=(other) Ilp::Term.new(self) >= other end
bounds()
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 22 def bounds @lower_bound..@upper_bound end
bounds=(range)
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 17 def bounds=(range) @lower_bound = range.min @upper_bound = range.max end
coerce(num)
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 54 def coerce(num) [Ilp::Constant.new(num), self] end
to_s()
click to toggle source
# File lib/ruby-cbc/ilp/var.rb, line 58 def to_s name.to_s end