Minimization algorithms on pure Ruby