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.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Set cardinality constraints on the number of assets invested in a portfolio object

`obj = setMinMaxNumAssets(obj,MinNumAssets,MaxNumAssets)`

sets cardinality constraints for a `obj`

= setMinMaxNumAssets(`obj`

,`MinNumAssets`

,`MaxNumAssets`

)`Portfolio`

,
`PortfolioCVaR`

, or `PortfolioMAD`

object.

`MinNumAssets`

and `MaxNumAssets`

are the
minimum and maximum number of assets invested in the portfolio, respectively.
The total number of allocated assets satisfying the Bound constraints is between
[`MinNumAssets`

, `MaxNumAssets`

]. For
details on the respective workflows when using these different objects, see
Portfolio Object Workflow, PortfolioCVaR Object Workflow,
and PortfolioMAD Object Workflow.

You can also use dot notation to set up a list of identifiers for assets.

obj = obj.setMinMaxNumAssets(MinNumAssets,MaxNumAssets);

Specifying empty values ([

`[]`

) for`MinNumAssets`

and`MaxNumAsssets`

removes limit constraints from the`Portfolio`

,`PortfolioCVaR`

, or`PortfolioMAD`

object.

`estimateAssetMoments`

| `estimateFrontier`

| `estimateFrontierByReturn`

| `estimateFrontierByRisk`

| `estimateFrontierLimits`

| `estimateMaxSharpeRatio`

| `estimatePortMoments`

| `estimatePortReturn`

| `estimatePortRisk`

| `estimatePortSharpeRatio`

| `setBounds`

| `setSolverMINLP`

- Working with 'Conditional' BoundType, MinNumAssets, and MaxNumAssets Constraints Using Portfolio Objects
- Working with 'Conditional' BoundType, MinNumAssets, and MaxNumAssets Constraints Using PortfolioCVaR Objects
- Working with 'Conditional' BoundType, MinNumAssets, and MaxNumAssets Constraints Using PortfolioMAD Objects
- Troubleshooting for Setting 'Conditional' BoundType, MinNumAssets, and MaxNumAssets Constraints
- Common Operations on the Portfolio Object
- Portfolio Optimization Examples
- Portfolio Optimization with Semicontinuous and Cardinality Constraints
- Mixed-Integer Quadratic Programming Portfolio Optimization: Problem-Based (Optimization Toolbox)