I wanted to optimize a portfolio based on a portfolio-wide CVaR constraint (i.e. $CVaR_p \leq 0.08$). Unfortunately, I only find solution that minimizes the entire CVaR of the Portfolio. Exhibit Gordon 2007

Do you mind telling me if I need to add a restriction or how to change the utility function?

Here, you find the initial data and optimization Link


I removed some stupid elements. I will give a full answer once I finished the semester at the university.


Paper Portfolio Optimization with Conditional Value-at-Risk Objective and Constraints

  • $\begingroup$ Check out "Portfolio Optimization with Conditional Value-at-Risk Objective and Constraints" by Krokhmal, Palmquist, and Uryasev $\endgroup$
    – John
    Apr 17, 2014 at 14:00
  • $\begingroup$ @John: I think they added a (C)VaR Constraint on the asset side. I want to minimize the variance of the portfolio and also force the portfolio not to extend a certain CVaR limit. Do you know how to implement such a optimizer/solver? $\endgroup$
    – Markus
    Apr 17, 2014 at 18:10
  • $\begingroup$ That paper comes very close to solving your issue. They show how to constrain the CVaR of a portfolio to an amount while maximizing return. All you have to do is replace the objective with minimizing variance. Alternately, after setting it up that way, you could replace the linearization with Alexander et al's approach in "Minimizing CVaR and VaR for a portfolio of derivatives", though you couldn't use an LP anymore. $\endgroup$
    – John
    Apr 17, 2014 at 19:16
  • $\begingroup$ @John: I followed the first hint and used LP to minimize variance and added a CVaR constraint. I didn't have that much success. Do you mind having a look at my "example"? $\endgroup$
    – Markus
    Apr 18, 2014 at 9:28
  • $\begingroup$ I would follow the progression of first getting the minimize CVaR to work, then max return given CVaR, then min variance given CVaR. The problem here is that you're not using Rockafellar & Urysev's approach at all. The weighted average CVaR of individual assets is not the CVaR of the portfolio. This doesn't work for variance, so it wouldn't work for CVaR. Read Rockafellar and Urysev's Optimization of Conditional Value at Risk. Both of the authors have presentations on their websites that explain it better. Check those out. $\endgroup$
    – John
    Apr 18, 2014 at 14:08

1 Answer 1


Writing a linear solver with a CVaR-Constraint is time-consuming. "Portfolio Safeguard" of "American Optimal Decision Inc." is optimized for such kind of problems.

In order to get it work, you must add the following elements:


  • matrix_scenarios (a matrix of all your returns)
  • matrix_returns (a vector containing the expected returns)


  • CVaR (cvar_risk)
  • linear (linear)
  • standard deviation (st_risk)


  • variance as objective
  • CVaR as constraint
  • budget as constraint
  • Box variables


  • you can run the optimization by pressing CTRL + o

Later I will illustrate the process.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.