This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Choosing and Controlling the Solver for Mean-Variance Portfolio Optimization

The default solver for mean-variance portfolio optimization is lcprog, which implements a linear complementarity programming (LCP) algorithm. Although lcprog works for most problems, you can adjust arguments to control the algorithm. Alternatively, the mean-variance portfolio optimization tools let you use any of the variations of quadprog from Optimization Toolbox™ software. Unlike Optimization Toolbox which uses the trust-region-reflective algorithm as the default algorithm for quadprog, the portfolio optimization tools use the interior-point-convex algorithm. For details about quadprog and quadratic programming algorithms and options, see Quadratic Programming Algorithms (Optimization Toolbox).

To modify either lcprog or to specify quadprog as your solver, use the setSolver function to set the hidden properties solverType and solverOptions that specify and control the solver. Since the solver properties are hidden, you cannot set these using the Portfolio function. The default solver is lcprog so you do not need to use setSolver to specify this solver. To use quadprog, you must set up the interior-point-convex version of quadprog using:

p = Portfolio;
p = setSolver(p, 'quadprog');
and you can switch back tolcprog with:
p = setSolver(p, 'lcprog');
In both cases, setSolver sets up default options associated with either solver. If you want to specify additional options associated with a given solver, setSolver accepts these options with argument name-value pair arguments in the function call. For example, if you intend to use quadprog and want to use the active-set algorithm, call setSolver with:
p = setSolver(p, 'quadprog', 'Algorithm', 'active-set');
In addition, if you want to specify any of the options for quadprog that are normally set through optimoptions, setSolver accepts an optimoptions object as the second argument. For example, you can start with the default options for quadprog set by setSolver and then change the algorithm to 'trust-region-reflective' with no displayed output:
p = Portfolio;
options = optimoptions('quadprog', 'Algorithm', 'trust-region-reflective', 'Display', 'off');
p = setSolver(p, 'quadprog', options);

See Also

| | | | | | | | | |

Related Examples

More About

External Websites

Was this topic helpful?