optimizes the portfolio details