How to add (soft?) constraints to the model?

Depending on the function f(), it might not be easy to do. One approach is to add the constrain using pm.Potential, but I am not sure it applies here.