Simplex algorithm in Ruby