gamma auto tuning

Added auto tuning of gamma (margin around zero) parameter.