This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Choosing and Controlling the Solver for PortfolioMAD Optimizations

When solving portfolio optimizations for a PortfolioMAD object, while all variations of fmincon from Optimization Toolbox™ are supported, using 'sqp' and 'active-set' algorithms for fmincon is recommended and the use of 'interior-point' algorithm is not recommended for MAD portfolio optimization.

Unlike Optimization Toolbox which uses the 'trust-region-reflective' algorithm as the default algorithm for fmincon, the portfolio optimization for a PortfolioMAD object uses the 'active-set' algorithm. For details about fmincon and constrained nonlinear optimization algorithms and options, see Constrained Nonlinear Optimization Algorithms (Optimization Toolbox).

To modify fmincon options for MAD portfolio optimizations, use setSolver to set the hidden properties solverType and solverOptions to specify and control the solver. Since these solver properties are hidden, you cannot set them using the PortfolioMAD object. The default solver is fmincon with the 'sqb' algorithm and no displayed output, so you do not need to use setSolver to specify this.

If you want to specify additional options associated with the fmincon solver, setSolver accepts these options as name-value pair arguments. For example, if you want to use fmincon with the sqp algorithm and with displayed output, use setSolver with:

p = PortfolioMAD;
p = setSolver(p, 'fmincon', 'Algorithm', 'sqp', 'Display', 'final');
display(p.solverOptions.Algorithm);
display(p.solverOptions.Display);
sqp
final

Alternatively, the setSolver function accepts an optimoptions object as the second argument. For example, you can change the algorithm to trust-region-reflective with no displayed output as follows:

p = PortfolioMAD;
options = optimoptions('fmincon', 'Algorithm', 'trust-region-reflective', 'Display', 'off');
p = setSolver(p, 'fmincon', options);
display(p.solverOptions.Algorithm);
display(p.solverOptions.Display);
trust-region-reflective
off

The mixed integer nonlinear programming (MINLP) solver, configured using setSolverMINLP, enables you to specify associated solver options for portfolio optimization for a PortfolioMAD object. When any one, or any combination of 'Conditional' BoundType, MinNumAssets, or MaxNumAssets constraints are active, the portfolio problem is formulated by adding NumAssets binary variables, where 0 indicates not invested, and 1 is invested. For more information on using 'Conditional' BoundType, see setBounds. For more information on specifying MinNumAssets and MaxNumAssets, see setMinMaxNumAssets.

When using the estimate functions with a PortfolioMAD object where 'Conditional' BoundType, MinNumAssets, or MaxNumAssets constraints are active, the mixed integer nonlinear programming (MINLP) solver is automatically used.

Solver Guidelines for PortfolioMAD Objects

The following table provides guidelines for using setSolver and setSolverMINLP.

Portfolio ProblemPortfolioMAD FunctionType of Optimization ProblemMain Solver Helper Solver
Portfolio without tracking error constraintsestimateFrontierByRiskOptimizing a portfolio for a certain risk level introduces a nonlinear constraint. Therefore, this problem has a linear objective with linear and nonlinear constraints.'fmincon' using setSolver

'linprog' using setSolver

Portfolio without tracking error constraintsestimateFrontierByReturnNonlinear objective with linear constraints'fmincon' using setSolver

'linprog' using setSolver

Portfolio without tracking error constraintsestimateFrontierLimits

Nonlinear or linear objective with linear constraints

For ‘min’: nonlinear objective, 'fmincon'using setSolver

For ‘max’: linear objective, 'linprog' using setSolver

Not applicable
PortfolioMAD with active 'Conditional' BoundType, MinNumAssets, and MaxNumAssetsestimateFrontierByRiskThe problem is formulated by introducing NumAssets binary variables to indicate whether the corresponding asset is invested or not. Therefore, it requires a mixed integer nonlinear programming solver. Three types of MINLP solvers are offered, see setSolverMINLP.Mixed integer nonlinear programming solver (MINLP) using setSolverMINLP'fmincon' is used when the estimate functions reduce the problem into NLP. This solver is configured through setSolver.
PortfolioMAD with active 'Conditional' BoundType, MinNumAssets, and MaxNumAssetsestimateFrontierByReturnThe problem is formulated by introducing NumAssets binary variables to indicate whether the corresponding asset is invested or not. Therefore, it requires a mixed integer nonlinear programming solver. Three types of MINLP solvers are offered, see setSolverMINLP.Mixed integer nonlinear programming solver (MINLP) using setSolverMINLP'fmincon' is used when the estimate functions reduce the problem into NLP. This solver is configured through setSolver
PortfolioMAD with active 'Conditional' BoundType, MinNumAssets, and MaxNumAssetsestimateFrontierLimitsThe problem is formulated by introducing NumAssets binary variables to indicate whether the corresponding asset is invested or not. Therefore, it requires a mixed integer nonlinear programming solver. Three types of MINLP solvers are offered, see setSolverMINLP.Mixed integer nonlinear programming solver (MINLP) using setSolverMINLP'fmincon' is used when the estimate functions reduce the problem into NLP. This solver is configured through setSolver

See Also

| | | | | | | | |

Related Examples

More About