Automatically building service-based systems with function relaxation