algorithm for calculating max U