class_docstr: Portfolio Optimizer
  
  The following optimization algorithms are supported:
      - `gmv`: Global Minimum Variance Portfolio
      - `mvo`: Mean Variance Optimized Portfolio
      - `rp`: Risk Parity
      - `inv`: Inverse Volatility
  
  Note:
      This optimizer always assumes full investment and no-shorting.
class_docstr_tok: ["Portfolio","Optimizer","The","following","optimization","algorithms","are","supported",":","-","`","gmv","`",":","Global","Minimum","Variance","Portfolio","-","`","mvo","`",":","Mean","Variance","Optimized","Portfolio","-","`","rp","`",":","Risk","Parity","-","`","inv","`",":","Inverse","Volatility","Note",":","This","optimizer","always","assumes","full","investment","and","no-shorting","."]
docstr: optimize mean-variance portfolio
  
  This method solves the following optimization problem
      min_w   - w' r + lamb * w' S w
      s.t.   w >= 0, sum(w) == 1
  where `S` is the covariance matrix, `u` is the expected returns,
  and `lamb` is the risk aversion parameter.
docstr_tok: ["optimize","mean-variance","portfolio","This","method","solves","the","following","optimization","problem","min_w","-","w","'","r","+","lamb","*","w","'","S","w","s.t",".","w",">","=","0",",","sum","(","w",")","==","1","where","`","S","`","is","the","covariance","matrix",",","`","u","`","is","the","expected","returns",",","and","`","lamb","`","is","the","risk","aversion","parameter","."]
code: def _optimize_mvo(
      self,
      S: np.ndarray,
      r: Optional[np.ndarray] = None,
      w0: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      """optimize mean-variance portfolio
  
      This method solves the following optimization problem
          min_w   - w' r + lamb * w' S w
          s.t.   w >= 0, sum(w) == 1
      where `S` is the covariance matrix, `u` is the expected returns,
      and `lamb` is the risk aversion parameter.
      """
      return self._solve(
          len(S),
          self._get_objective_mvo(S, r),
          *self._get_constrains(w0),
      )
  
file_path: qlib/qlib/contrib/strategy/optimizer/optimizer.py
imports: import warnings
  import numpy
  import pandas
  import scipy.optimize
  from typing import Optional, Union, Callable, List
  from .base import BaseOptimizer
label_desc: Use image node_id 6 for calling the PortfolioOptimizer obj's underlying member method code with example usage: obj._optimize_mvo(S, r, w0) and returns: self