Class: Amor::Objective

Inherits:
Object
  • Object
show all
Defined in:
lib/amor/objective.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(direction, expression) ⇒ Objective

Returns a new instance of Objective.



6
7
8
9
# File 'lib/amor/objective.rb', line 6

def initialize(direction, expression)
  @direction = direction
  @expression = Expression.new(expression)
end

Instance Attribute Details

#directionObject (readonly)

Returns the value of attribute direction.



4
5
6
# File 'lib/amor/objective.rb', line 4

def direction
  @direction
end

#expressionObject (readonly)

Returns the value of attribute expression.



4
5
6
# File 'lib/amor/objective.rb', line 4

def expression
  @expression
end

Instance Method Details

#lp_stringObject



11
12
13
14
# File 'lib/amor/objective.rb', line 11

def lp_string
  direction_string = (@direction == :maximize ? "Maximize" : "Minimize")
  "#{direction_string}\n obj: #{@expression.lp_string}"
end