lib/compsci/simplex/parse.rb in compsci-0.3.0.1 vs lib/compsci/simplex/parse.rb in compsci-0.3.1.1
- old
+ new
@@ -82,19 +82,19 @@
end
end
def self.problem(maximize: nil, constraints: [], **kwargs)
if maximize
- obj, maximize = maximize, true
+ expr, maximize = maximize, true
elsif kwargs[:minimize]
- obj, maximize = kwargs[:minimize], false
+ expr, maximize = kwargs[:minimize], false
else
raise(ArgumentError, "one of maximize/minimize expected")
end
- unless obj.is_a?(String)
+ unless expr.is_a?(String)
raise(ArgumentError, "bad expr: #{expr} (#{expr.class})")
end
- obj_cof = Parse.expression(obj)
+ obj_cof = Parse.expression(expr)
c = [] # coefficients of objective expression
a = [] # array (per constraint) of the inequality's lhs coefficients
b = [] # rhs (constant) for the inequalities / constraints