Documentation

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.

setInequality

Set up linear inequality constraints for portfolio weights

Use the setInequality function with a Portfolio, PortfolioCVaR, or PortfolioMAD object to set up linear inequality constraints for portfolio weights for portfolio objects.

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

Syntax

obj = setInequality(obj,AInequality,bInequality)

Description

example

obj = setInequality(obj,AInequality,bInequality) sets up linear inequality constraints for portfolio weights for portfolio objects.

Given a linear inequality constraint matrix AInequality and vector bInequality, every weight in a portfolio Port must satisfy the following:

AInequality * Port <= bInequality

Examples

collapse all

Suppose you have a portfolio of five assets and you want to ensure that the first three assets are no more than 50% of your portfolio. Given a Portfolio object p, set the linear inequality constraints with the following.

A = [ 1 1 1 0 0 ];
b = 0.5;
p = Portfolio;
p = setInequality(p, A, b);

disp(p.NumAssets);
     5
disp(p.AInequality);
     1     1     1     0     0
disp(p.bInequality);
    0.5000

Suppose you have a portfolio of five assets and you want to ensure that the first three assets are no more than 50% of your portfolio. Given a CVaR portfolio object p, set the linear inequality constraints with the following.

A = [ 1 1 1 0 0 ];
b = 0.5;
p = PortfolioCVaR;
p = setInequality(p, A, b);

disp(p.NumAssets);
     5
disp(p.AInequality);
     1     1     1     0     0
disp(p.bInequality);
    0.5000

Suppose you have a portfolio of five assets and you want to ensure that the first three assets are no more than 50% of your portfolio. Given PortfolioMAD object p, set the linear inequality constraints with the following.

A = [ 1 1 1 0 0 ];
b = 0.5;
p = PortfolioMAD;
p = setInequality(p, A, b);

disp(p.NumAssets);
     5
disp(p.AInequality);
     1     1     1     0     0
disp(p.bInequality);
    0.5000

Input Arguments

collapse all

Object for portfolio, specified using Portfolio, PortfolioCVaR, or PortfolioMAD object. For more information on creating a portfolio object, see

Matrix to form linear inequality constraints, specified as a matrix for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

An error results if AInequality is empty and bInequality is nonempty.

Data Types: double

Vector to form linear inequality constraints, specified as a vector for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

An error results if AInequality is nonempty and bInequality is empty.

Data Types: double

Output Arguments

collapse all

Updated portfolio object, returned as a Portfolio, PortfolioCVaR, or PortfolioMAD object. For more information on creating a portfolio object, see

Tips

  • You can also use dot notation to set up linear inequality constraints for portfolio weights.

    obj = obj.setInequality(AInequality, bInequality);

  • To remove inequality constraints, enter empty arguments. To add to existing inequality constraints, use addInequality.

Introduced in R2011a

Was this topic helpful?