implement downhill simplex