[MRG] new fit_workspace function and improved minimize