Class: MIPPeR::Constraint
- Inherits:
-
Object
- Object
- MIPPeR::Constraint
- Defined in:
- lib/mipper/constraint.rb
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
-
#index ⇒ Object
Returns the value of attribute index.
-
#model ⇒ Object
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rhs ⇒ Object
readonly
Returns the value of attribute rhs.
-
#sense ⇒ Object
readonly
Returns the value of attribute sense.
Instance Method Summary collapse
-
#initialize(expr, sense, rhs, name = nil) ⇒ Constraint
constructor
A new instance of Constraint.
- #inspect ⇒ Object
Constructor Details
#initialize(expr, sense, rhs, name = nil) ⇒ Constraint
Returns a new instance of Constraint.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/mipper/constraint.rb', line 6 def initialize(expr, sense, rhs, name = nil) @expression = expr @sense = sense @rhs = rhs @name = name # Store this constraint for each associated variable @expression.terms.each_key do |var| var.constraints << self end end |
Instance Attribute Details
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
4 5 6 |
# File 'lib/mipper/constraint.rb', line 4 def expression @expression end |
#index ⇒ Object
Returns the value of attribute index.
3 4 5 |
# File 'lib/mipper/constraint.rb', line 3 def index @index end |
#model ⇒ Object
Returns the value of attribute model.
3 4 5 |
# File 'lib/mipper/constraint.rb', line 3 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/mipper/constraint.rb', line 4 def name @name end |
#rhs ⇒ Object (readonly)
Returns the value of attribute rhs.
4 5 6 |
# File 'lib/mipper/constraint.rb', line 4 def rhs @rhs end |
#sense ⇒ Object (readonly)
Returns the value of attribute sense.
4 5 6 |
# File 'lib/mipper/constraint.rb', line 4 def sense @sense end |
Instance Method Details
#inspect ⇒ Object
18 19 20 |
# File 'lib/mipper/constraint.rb', line 18 def inspect "#{@expression.inspect} #{sense.to_s} #{rhs}" end |