Dynamic portfolio optimization with inverse covariance clustering