optimize leastsquares