There are two approaches to this problem:
Method 1: Using the ‘setInequality’ method.
If you have A and b matrices such that "Ax <= b" with portfolio "x" (i.e. weights) and a reference portfolio "x0", the active constraint has the form
where "y" are the active portfolio weights. These must satisfy a budget constraint defined as:
The sum of the active weights "y" is zero because y = x - x0, and the sum of the weights for both "x" and "x0" is 1.
The constraints can be set up directly in the Portfolio object with
p = Portfolio;
p = p.setInequality(A, b - A*x0);
p.setBudget(0, 0);
and then you set up your additional information to form a proper portfolio optimization problem (means, covariances, etc.)
Method 2: Using the output of ABS2ACTIVE
When you use the output from ABS2ACTIVE to determine the constraints, the procedure would be
p = Portfolio;
c = abs2active([A, b], x0);
p = p.setInequality(c(:,1:end-1),c(:,end));
p = p.setBudget(0, 0);
Best Answer