threshold acceptance algorithm