Class: Constraint
Overview
An LP Expression constraint. A mathematical expression of which the result must be constrained in some way.
Instance Method Summary collapse
- #constraint_op ⇒ Object
-
#initialize(*constraint_expression) ⇒ Constraint
constructor
A new instance of Constraint.
- #to_s ⇒ Object
- #variables ⇒ Object
Constructor Details
#initialize(*constraint_expression) ⇒ Constraint
Returns a new instance of Constraint.
8 9 10 |
# File 'lib/rulp/constraint.rb', line 8 def initialize(*constraint_expression) @expressions , @constraint_op, @value = constraint_expression end |
Instance Method Details
#constraint_op ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rulp/constraint.rb', line 20 def constraint_op case "#{@constraint_op}" when "==" "=" when "<" "<=" when ">" ">=" else @constraint_op end end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/rulp/constraint.rb', line 16 def to_s return "#{@expressions} #{constraint_op} #{@value}" end |
#variables ⇒ Object
12 13 14 |
# File 'lib/rulp/constraint.rb', line 12 def variables @expressions.variables end |