class Amor::Variable

Attributes

index[R]
lb[RW]
lower_bound[RW]
model[R]
type[RW]
ub[RW]
upper_bound[RW]
value[RW]

Public Class Methods

new(model, index) click to toggle source
# File lib/amor/variable.rb, line 10
def initialize(model, index)
  @model = model
  @index = index
end

Public Instance Methods

*(scalar) click to toggle source
# File lib/amor/variable.rb, line 15
def *(scalar)
  Expression.new([[scalar, self]])
end
+(value) click to toggle source
# File lib/amor/variable.rb, line 19
def +(value)
  Expression.new(self) + Expression.new(value)
end
-(value) click to toggle source
# File lib/amor/variable.rb, line 23
def -(value)
  self + -value
end
-@() click to toggle source
# File lib/amor/variable.rb, line 27
def -@
  Expression.new([[-1, self]])
end
<=(value) click to toggle source
# File lib/amor/variable.rb, line 39
def <= value
  Constraint.new(self, :lesser_equal, value)
end
==(value) click to toggle source
# File lib/amor/variable.rb, line 35
def == value
  Constraint.new(self, :equal, value)
end
>=(value) click to toggle source
# File lib/amor/variable.rb, line 43
def >= value
  Constraint.new(self, :greater_equal, value)
end
internal_index() click to toggle source
# File lib/amor/variable.rb, line 31
def internal_index
  @model.internal_index(self.index)
end
to_s() click to toggle source
# File lib/amor/variable.rb, line 47
def to_s
  "x(#{index})"
end