class Amor::Constraint
Attributes
index[RW]
lhs[R]
relation[R]
rhs[R]
Public Class Methods
new(lhs, relation, rhs)
click to toggle source
# File lib/amor/constraint.rb, line 6 def initialize(lhs, relation, rhs) @lhs = Expression.new(lhs) @rhs = Expression.new(rhs) @relation = relation end
Public Instance Methods
lp_name()
click to toggle source
# File lib/amor/constraint.rb, line 26 def lp_name "c#{index+1}" end
lp_string()
click to toggle source
# File lib/amor/constraint.rb, line 12 def lp_string temp_lhs = (@lhs - @rhs).simplified relation_string = case @relation when :greater_equal ">=" when :lesser_equal "<=" else "=" end "#{lp_name}: #{temp_lhs.remove_constants.lp_string} #{relation_string} #{-temp_lhs.constant_factor}" end
to_s()
click to toggle source
# File lib/amor/constraint.rb, line 30 def to_s relation_string = case @relation when :greater_equal ">=" when :lesser_equal "<=" else "==" end "#{@lhs} #{relation_string} #{@rhs}" end