class Ilp::Objective

Constants

MAXIMIZE
MINIMIZE

Attributes

objective_function[RW]
terms[RW]

Public Class Methods

new(terms, objective_function = MAXIMIZE) click to toggle source
# File lib/ruby-cbc/ilp/objective.rb, line 7
def initialize(terms, objective_function = MAXIMIZE)
  @terms = terms
  @terms = Ilp::Term.new(@terms) if @terms.is_a? Ilp::Var
  @terms = Ilp::TermArray.new([@terms]) if @terms.is_a? Ilp::Term
  @terms.normalize!
  @terms.send(:pop_constant)
  @objective_function = objective_function
end

Public Instance Methods

to_s() click to toggle source
# File lib/ruby-cbc/ilp/objective.rb, line 16
def to_s
  "#{(@objective_function == :max ? 'Maximize' : 'Minimize')}\n  #{terms}"
end