Optimization of a neutrino factory for non-standard neutrino interactions