LP Algorithms for Portfolio Optimization: The PortfolioOptim Package

The paper describes two algorithms for financial portfolio optimization with the following risk measures: CVaR, MAD, LSAD and dispersion CVaR. These algorithms can be applied to discrete distributions of asset returns since then the optimization problems can be reduced to linear programs. The first algorithm solves a simple recourse problem as described by Haneveld using Benders de composition method. The second algorithm finds an optimal portfolio with the smallest distance to a given benchmark portfolio and is an adaptation of the least norm solution (called also normal solution) of linear programs due to Zhao and Li. The algorithms are implemented in R in the package PortfolioOptim.

Andrzej Palczewski

Supplementary materials

Supplementary materials are available in addition to this article. It can be downloaded at RJ-2018-028.zip

CRAN packages used

fPortfolio, PortfolioAnalytics, Rglpk, quadprog, DEoptim, GenSA, psoptim, parma, nloptr, PortfolioOptim

CRAN Task Views implied by cited packages

Optimization, Finance


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Palczewski, "The R Journal: LP Algorithms for Portfolio Optimization: The PortfolioOptim Package", The R Journal, 2018

BibTeX citation

  author = {Palczewski, Andrzej},
  title = {The R Journal: LP Algorithms for Portfolio Optimization: The PortfolioOptim Package},
  journal = {The R Journal},
  year = {2018},
  note = {https://doi.org/10.32614/RJ-2018-028},
  doi = {10.32614/RJ-2018-028},
  volume = {10},
  issue = {1},
  issn = {2073-4859},
  pages = {308-327}