Bankruptcy prevention in multiperiod Markowitz optimization problem