I would like to optimize a portfolio allocation (maximizing the exposure or the expected return), but with asset constraints. (some parts of my portfolio cannot exceed a certain minimum or maximum). For example, 60% max on equity and 5% min on cash, say for liquidity. Let's say there are five assets, cash, US and UK equity, US fixed income, and US property.

How can I achieve that? Is there a way to turn the problem into a linear programming problem? or to approximate the results?

Any links or ideas are welcome.

  • 1
    $\begingroup$ Seems like a relatively straightforward portfolio problem that CVXOPT or GoalSeek could easily solve, but perhaps I misunderstood the problem (or I am missing some complications). You are right that the asset constraints are just linear inequality constraints, easy to handle. $\endgroup$
    – nbbo2
    Nov 11, 2016 at 17:21

3 Answers 3


There are very powerful software solutions out there, so you should not reinvent the wheel.

One notable R package is PortfolioAnalytics.

You can find a very good introduction here, where your concrete constraints requirement is addressed in section 3.3, p. 6:

Benett, R.: Introduction to PortfolioAnalytics (2015)

  • $\begingroup$ Thanks, any expertise is using nested constraints and/or own covar or correlation matrix? There is nothing documented there. $\endgroup$
    – rrg
    Nov 14, 2016 at 18:03

You are formulating the problem of portfolio allocation as that of maximizing expected portfolio return without regard to risk.

This a linear programming problem.

If you are prevented from going short, the solution will be to max out your allocation of the best performing asset and then second best, etc...

Otherwise, you can use quadratic optimization software cvxopt.


I agreed with the usage of PortfolioAnalytics package of R programming, but before that I must say read, read, read and try to understand the concept from book written on Active Equity Portfolio Management by Grinold and Kahn. Combination of both will gives you tremendous results of your objective. All the Best.


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.