[R-SIG-Finance] Optimization Constraint Violations

Brian G. Peterson brian at braverock.com
Mon Feb 22 12:00:25 CET 2010


fPortfolio uses quadprog underneath, so I don't know that using quadprog 
directly does anything other than lose the portability of the portfolio 
specification in fPortfolio.

Mattias raises the correct point, that fPortfolio will 'fall back' on 
unconstrained optimization when optimization is not possible with a given 
constraint set.  I believe that the unconstrained optimization is always 
performed, such that the efficient frontier is known and may be plotted against 
the constrained efficient frontier.

It is possible in any portfolio optimization problem, Markowitz MV or not, to 
specify constraints and objectives that are unreasonable.  Pat Burns has 
correctly suggested in his many writings that random portfolios can help to 
define the shape of the available space.  A portfolio manager also rapidly 
wants to specify constraints or objectives that are not amenable to a quadratic 
solution, and then other optimization engines are required.  Linear and Conical 
solvers are available in fPortfolio for some more robust approaches. Fully 
non-linear approaches such as random portfolios, simulated annealing, and 
differential evolution are available in other R packages.

However, none of this will matter if the combination of objectives and 
constraints are unreasonable.

And, to echo the other posters, please do take the time to construct a minimal 
example that shows what you're seeing.  It is really not to hard to either use 
publicly available data, or to disguise your data, such that we can see what's 
causing the problem.

Regards,

     - Brian

julien cuisinier wrote:
> I agree on the use of quadprog package, I do not know fPortfolio package and its MV optimization function but I can only guess it is done to provide an output in any case, i.e. whether an optimal solution fit within the constraints or not (so considering the constraints as soft by default)...but that only a guess.
> Indeed providing a reproducible code would make much easier to investigate what's going on.
> 
>> Sarbo writes:
>>
>> Would you mind including the code that you're using? It will be (much)
>> easier to figure out what's going on once we know precisely what the
>> constraints and the objective function are.
>>
>> One other thing- if you're looking to find the standard Markowitz
>> optimal portfolio with multiple assets and weightings, I recommend using
>> the "quadprog" package. I've used it before to solve such problems and
>> it does the job pretty nicely.
>>
>> On Sun, 2010-02-21 at 23:31 -0500, Todd Chadwick wrote:
>>
>>> Hi all,
>>>
>>> I'm stumped with a portfolio optimization issue.  I'm utilizing the
>>> fPortfolio package (although I know this issue is more general) and I am
>>> trying to perform a vanilla MV optimization using both a weighting
>>> constraint (box constrained and sum to unity) and target return
>>> specification (specifically using the "efficientPortfolio()" wrapper
>>> function).  My puzzle is that sometimes the box constraints are violated and
>>> I am curious as to either what else I need to consider (I suspect the issue
>>> involves the target return spec) or how to force the constraints to be
>>> honored.  
>>>
>>> Sorry no data examples to provide, but I hope that the experience of the
>>> collective can shed some light for a rookie.
>>>
>>> Todd


-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list